Handling Folders for Parent Path Reporting
Handling Folders for Parent Path Reporting
- Subject: Handling Folders for Parent Path Reporting
- From: Gary Lists <email@hidden>
- Date: Sat, 04 Jan 2003 18:12:03 -0500
I use the following to retrieve the "parent" folder information about files.
My problem is dealing with a folder itself, and its last colon. (As it is,
the only error is logical -- it reports itself and not its own parent.)
I've tried several bits of math to get to the _next_ (further left) colon,
but I fear I need another colon-oscopy. Could you take a look and tell me
how to "fix" x so that it gets the right offset if the value of x is 1 at
first?
Thanks.
My code...
-- irrelevant...just getting the dropsies
on open dropped
-- handle multiple things dragged from same level
if dropped's class is list then set dropped to item 1 of dropped
set parentThing to parentFrom(dropped)
display dialog parentThing
end open
-- my inability is centered here,
-- when x is first a 1 (colon at the end)
on parentFrom(fileThing)
set fileThing to fileThing as text
set x to the offset of ":" in (the reverse of every character of[NO
BREAK] fileThing) as string
set parentFolder to (characters 1 thru -(x) of fileThing) as text
return parentFolder
end parentFrom
I've tried what I thought was repeating and shortening the fileThing's text
value if the end was :, and then setting offset again. I need the second
offset if the first is equal to 1.
Thanks, and sorry for such simple algebraic failure. (Counting offsets in
reverse of and concepts like character -2 of a string is boggling me
today...or maybe most days. Is character -1 the thing past the end? Or the
thing before the beginning? Oy! )
--
Gary
Incoming replies are auto-deleted.
Please post directly to the list or newsgroup.
Really need direct? Rot me at:
email@hidden
Lbhe fhowrpg zhfg ortva "abgwhax:" (ab dhbgrf)
Avpr gb zrrg lbh! Qba'g fcnz zr.
_______________________________________________
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.