Re: Reverse Offset (was Getting the Folder name when using drag-&-drop Scripts)
Re: Reverse Offset (was Getting the Folder name when using drag-&-drop Scripts)
- Subject: Re: Reverse Offset (was Getting the Folder name when using drag-&-drop Scripts)
- From: Christopher Nebel <email@hidden>
- Date: Thu, 11 Mar 2004 14:49:40 -0800
On Mar 11, 2004, at 1:27 AM, jj wrote:
Hey, I like that 'reverse' method. Now I've made a nice routine:
on ReverseOffset(ftxt, wtxt)
local ftxt, wtxt, ftxt_r, wtxt_r, o_r
set ftxt_r to (reverse of characters in ftxt) as string
set wtxt_r to (reverse of characters in wtxt) as string
set o_r to (offset of ftxt_r in wtxt_r as string)
if o_r is 0 then return 0
2 + (length of wtxt) - o_r - (length of ftxt)
end ReverseOffset
Only briefly tested just now, but seems to do right.
Though now, in Panther, your routine will fail ... You need now the
"considering case" statement for "offset of":
What you call failure, I call behaving like all the other string
operators. This was a documented change. If you want to consider
case, then yes, you should add a "considering case" block somewhere,
but I'd argue that inside the handler is the wrong place, since then it
won't act like regular "offset".
--Chris Nebel
AppleScript Engineering
_______________________________________________
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.