Signature appPath launch with nested appName tells...
Signature appPath launch with nested appName tells...
- Subject: Signature appPath launch with nested appName tells...
- From: Harald E Brandt <email@hidden>
- Date: Sun, 4 Mar 2001 12:38:39 +0100
Marc K. Myers <email@hidden> wrote weeks ago (2001-02-12), nice hints on how to launch apps without the need to always know the exact name or version of the app. This was proposed to a person interested in Apple software Restore:
+-
>
Find out what the signature (Creator Type) for Apple Software Restore
>
is. For this example we'll say it's "ASRe". Than call the app like this:
>
>
tell application "Finder"
>
set appPath to application file id "ASRe" as string
>
set appName to name of application file id "ASRe"
>
end tell
>
launch application appPath
>
tell application "Apple Software Restore"
>
tell application appName
>
[Do Stuff]
>
end tell
>
end tell
+-
And Marc thus explained:
+-
>
The extra layer of "tell...end tell" with the application's name is
>
there so the compiler can know what application it's compiling the
>
commands for. It should have no effect at run time.
>
>
The outer layer of "tell" provides that access at compile time. The inner layer directs the commands to the actual process that's running at run time.
+-
However....
When I try this scheme with e.g AppleWorks or Tex-Edit Plus, it simply refuses to work if I keep the inner tell!!
It simply doesn't like that nesting, as if to protest against claiming AppleWorks 6 can be an element of AppleWorks 6! It does not matter if I run the script from the Script Editor or as an applet. However, if I remove that inner tell, it works just fine! Also, it works if I swap those tells in the opposite order, so that the inner tell is "AppleWorks 6" and the outer tell appName. But does really the inner tell then have any effect? I haven't found a case where it does.
* So, the bottom line questions are: *
* When is that appName tell possible?
* and when will it ever be useful?
(My obvious goal is of course that I don't want to depend on the exact name of the version of the program.)
With the Best Regards,
______heb________________________________________________________________
Harald E Brandt email@hidden PGP/MIME aware
http://heb.surf.to