Re: Path-Strings to Formatted String
Re: Path-Strings to Formatted String
- Subject: Re: Path-Strings to Formatted String
- From: Arthur J Knapp <email@hidden>
- Date: Fri, 15 Feb 2002 20:26:24 -0500
>
Arthur,
>
>
I wrote this a while ago, and I don't remember if I sorted the folders but
>
it should do what you need.
Thank you Jason, I appreciate your response, but I'm afraid that this
was not what I was looking for.
>
Save it as a droplet and drop a folder onto it.
Yeah, I really didn't explain the problem very well. I wasn't looking
for a folder-traversal script. In fact, I have written several such
scripts myself.
>
on open theseItems
[snip]
>
tell application "Finder"
The first problem is that my data is a list of path-strings, not
actual folder aliases or Finder objects. Secondly, in many cases,
my script needs to parse such information even when it was
generated on another computer, ie: the path-strings may not even
represent folders on the computer that my script is running on.
Because of this, the Finder cannot really assist in the problem.
[snip]
>
set thisItem to (item i of theseItems)
>
set the itemInfo to info for thisItem
>
if folder of the itemInfo is true then
Right, find out if a given item is a folder, then recurse appropriately.
The problem in my situation is that there is no fast way to know if
one folder "belongs" to another, ie: each path-string has it's entire
path in front of it, requiring one to parse out where in the heirarchy
it belongs, as opposed to recursing from one folder to another, where
you know that every item found at one level "belongs" at that level.
>
on ASCIISort(myList)
Somewhat off of the topic: Why did the AppleScript team call this
"ASCII" sort? It is a serious misnomer.
To state the problem more succinctly, given *exactly* this type of data:
{ "MacHD:Projects:Project 1:Art:CHAP01:",
"MacHD:Projects:Project 1:Art:CHAP02:",
"MacHD:Projects:Project 2:Art:CHAP01:",
"MacHD:Projects:Project 2:Art:CHAP02:",
"MacHD:Projects:Project 2:Old:CHAP01:",
"MacHD:Projects:Project 2:Old:CHAP02:"
}
what is the best way for me to obtain this string:
"MacHD:
Projects:
Project 1:
Art:
CHAP01:
CHAP02:
Project 2:
Art:
CHAP01:
CHAP02:
Old:
CHAP01:
CHAP02:
"
where the indentations are tabs?
{ Arthur J. Knapp, of <
http://www.STELLARViSIONs.com>
<
mailto:email@hidden>
try
<
http://www3.sympatico.ca/victor.yee/>
on error number -128
end try
}
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.