Re: recordable finder
Re: recordable finder
- Subject: Re: recordable finder
- From: John Stewart <email@hidden>
- Date: Wed, 29 Oct 2003 13:01:53 -0500
On 10/29/03 at 10:06, the entity Thomas Taylor spoke thusly
>
1) I guess I'm alittle surprised why one would go through the efforts
>
of making finder recordable and stop it's capabilities at just finding
>
the file. That's pretty sad when you say finder is recordable, but
>
only generates one line of code.
>
>
Finder opens files for you through normal interaction. The object
>
'file' 'target' (whatever you want to call it) should have a method
>
'open', that takes the files properties, and perform that method
>
AUTOMAGICALLY using that application property defined in the file.
>
This very simple operations should be getting easier?
>
>
2) Using that generated line of code, I tried a number of combinations
>
to open the file, still no luck.
>
>
3) Looked in the improved dictionary, there's alot more confusing
>
terms, nothing highlighting any recordable capabilities. Are the
>
recorded capabilities documented anywhere (please don't respond back
>
with: press the record button, and if you get code, it's recordable)?
>
I'm looking for the missing link between where the recorder stops and
>
the dictionary starts, and if the two actually meet.
I can understand how you would find all this confusing given that the Finder hasn't been recordable
in OS X prior to 10.3 and also given that what testing I've done with it has been very unsatisfactory
so far.
Recording itself is sometimes a good way to figure out how to perform an action you are having
dificulty grokking in some other manner i.e by reading the dictionary. That's almost the only time I
use recording because the script produced rarely runs without some major tweaking.
For instance, here are two scripts, they both perform the identical task of opening a folder named
"iTunes" located on my desktop. The first example is a verbatim recording made in Script Debugger
using the Finder and the second is how I would actually write it in a project. Note that there are
more than two ways of doing this.
(* Script 1 *)
tell application "Finder"
activate
make new Finder window to folder "iTunes" of folder "Desktop" of folder "john" of folder "Users"
of startup disk
end tell
(* Script 2 *)
tell application "Finder" to open alias ((path to "desk" as string) & "iTunes:") -- alias not needed
There are some major differences in these two -
1. (5 lines as opposed to 1)
2. the utility - Script 1 will only work on my machine unless the user on another machine happens to
have a short name of "john". Script 2 will work on anyone's machine assuming the presence of the
"iTunes" folder on the desktop.
3. They use different commands to accomplish their task, since I want to open an existing object not
make a new one, I would consider script 1 to be misleading in this case.
Recording capabilities have never been documented in a Dictionary.
There are only two ways of discovering the recordability of an application, 1 is "click the button
and see if you get code", 2 is someone tells you and you "click the button and see if you get code".
The missing link you are looking for is just that, missing.
There is rarely a good correlation between the code generated by a recording session and what could
be written by using the dictionary of the recorded application.
Recording is a convenience which (usually) gives you a very narrow and focused place to start,
nothing more. I use it when needed and it's bailed me out a few times when I've been stuck.
John
_______________________________________________
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.