Re: "tell" to a running process
Re: "tell" to a running process
- Subject: Re: "tell" to a running process
- From: Steven Angier <email@hidden>
- Date: Sat, 16 Mar 2002 10:32:05 +1100
- Organization: Macscript.com
Giuliano Gavazzi wrote:
>
Thanks, so you would perhaps use GetAppFile to get the path to the target?
Yes, you could use GetAppFile() to acquire the path to the given application. But if there
will never be more than one copy of the application running then GetAppName() might work
better.
Most of the basic process control functions in the Library (e.g. DoesAppExist(),
IsProcessRunning(), LaunchApp(), QuitProcess()) can be supplied a creator type, a name, or
a file; but you will need to reference the app by name to do anything fancier (using either
the double-tell or "using terms from" techniques).
For example, if we want to target FileMaker Pro (creator = "FMP5"):
------
prop kFMPCreator:"FMP5"
--error if the app doesn't exist on the target machine
if not DoesAppExist(kFMPCreator) then error "FileMaker Pro could not be found." number
-1728
--otherwise, see if the app is running already and launch it if needed
if not IsProcessRunning(kFMPCreator) then LaunchApp(kFMPCreator)
--do more involved stuff with FileMaker
tell app GetAppName(kFMPCreator) to tell app "FileMaker Pro"
--statements
end
--quit FileMaker if desired
if IsProcessRunning(kFMPCreator) then QuitProcess(kFMPCreator)
------
If you wanted to target a specific version of an application, you could feed all of these
functions a file path instead.
>
I would rather not use a scripting addition, otherwise I would write
>
it. If my application + script (I am the author of both) can avoid
>
adding extra system level items I am happier.
The Macscript.com Library is not a Scripting Addition. It is simply a code library that is
embedded in your script at compile time. The machines you deploy onto don't need to have it
installed or even know about it.
Regards,
Steven Angier
Macscript.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.