Re: Error opening file
Re: Error opening file
- Subject: Re: Error opening file
- From: Matthew Stuckwisch <email@hidden>
- Date: Mon, 13 May 2002 15:17:25 -0500
I am having trouble discovering why I can't get this to work. When I
attempt to following script:
set macroName to "*rodentHeart.obj.2.04a"
set macroPath to "/GAIA/*Test Macros"
tell application "Finder"
select item macroName of macroPath
open selection
end tell
I get the following error at the 'select item macroName of macroPath'
line:
Execution Error
Can't make "*rodentHeart.obj.2.04a" into a integer.
The macroName and macroPath refer to valid names and paths, so why the
error?
What you're trying to do is similar to the following, which I think you'll
agree should not work.
set x to item "a" of {"a", "b", "c", "d", "e"}
References to list items are done in integers, hence AppleScript will
coerce the value following the term "item" into an integer. This is why
you can have some variables after "item". However, a la vez, a string can
not be coerced into an integer. Think about it for a second, what is the
numerical value of "a" (no text encoding flames here, mmkay?)? There isn'
t one, it's a letter. In the same way, "*rodentHeart.obj.2.04.a" can't be
converted into an integer to locate a specific item in a list and errors
on the conversion. There are numerous ways to find the offset in a list,
which is what I believe you're trying to do (loops are the easiest, speed
freaks can find you the fastest *cough-SPEED-FREAK-ALERT-cough* ).
Matthew Stuckwisch
[AIM/MSN]{GuifaSwimmer} | [Yahoo!]{SapphireTree} | [ICQ]{137477701}
[IRC]{guifa / G}(esperNET / irc.massinova.com)
_______________________________________________
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.