Re: Confounding Issues with AppleScript
Re: Confounding Issues with AppleScript
- Subject: Re: Confounding Issues with AppleScript
- From: Emmanuel <email@hidden>
- Date: Fri, 6 Apr 2001 14:16:48 +0200
At 3:34 +0200 6/04/01, Paul Chadha wrote:
>
#1.
>
>
The scripts target an application that can reside anywhere on disk
>
(remote/local). How can I dynamically supply the location of the target
>
application so the script executes without the famous dialog "Please locate
>
the Software xxxx" appearing?
Here is a sample I use to check for QuickTime Player (whose creator is "TVOD"):
----------------------------
on QTPlayerLaunched(theDlog)
try
tell application "Finder" to set theAppName to name of
first process whose creator type is "TVOD"
return true
on error
set theAppName to ""
return false
end try
end QTPlayerLaunched
on LaunchQTPlayer(theDlog) -- error handling chopped off
tell application "Finder" to open application file id "TVOD"
return QTPlayerLaunched(theDlog)
end LaunchQTPlayer
----------------------------
Subsequent calls to QuickTime Player would go:
----------------------------
tell application theAppName to ...
----------------------------
For this portability issue, you need to convert scripts to raw codes. This
is documented in the Help of Smile, a script editor that my company makes
freely available.
>
#2.
>
>
Is it possible to maintain state information across the invocation of
>
scripts? For example, I invoke script "A" and I expect some kind of return
>
type. Then I invoke Script "B" and pass it the return type from "A" etc...
If you mean maintaining state information between calls from the C++, one
way to go could be to define a common context to all your scripts, and run
them in that context. Global variables would be shared.
>
#3.
>
>
Can the invoked AppleScripts return appropriate errors to the C/C++ caller
>
application.
Of course yes. Check the errors returned by the C++ AS routines.
Emmanuel
PS
I think there is a sibling list named "AppleScript-implementors", which may
be more concerned by those questions. In my experience, you subscribe, then
you receive very little mail because it's a small noise list, then you
receive none at all, eventually you check whether you are still subscribed,
and you are no more.