Re: On quitting an application (John Allen)
Re: On quitting an application (John Allen)
- Subject: Re: On quitting an application (John Allen)
- From: email@hidden
- Date: Thu, 10 Jun 2004 09:22:24 -0400
I am working with ... Java application ... Servoy ... I [want] to
stop another (background) process run by Sybase ASA whenever I quit
Servoy ... I was thinking that maybe I could get Applescript to do
this.
If you are looking for AppleScript, AS, code that you are going to
somehow embed into your Java application, then - you can use either
of the two lines of code below.
tell application "System Finder" to if (process "VLC" exists) then
tell application "VLC" to quit
... or ...
tell application "System Events" to if (process "VLC" exists) then
tell application "VLC" to quit
... where you will substitute 'VLC' with the name of the 'Sybase ASA'
process you want to quit.
How you would embed the above code into your java's source code, I do
not know, at present.
-----
If you want an independent AppleScript Applet running - not exactly
in the background [it will be listed on the 'Dock'], waiting for
'Servoy' to quit; and, to then have the Applet to quit the 'Sybase
ASA' process, then, paste the next six lines of code into 'Script
Editor'
on idle
tell application "System Events" to if (not (process "Servoy"
exists)) then tell application "..." to quit
-- The next line tells this Applet to run 'do idle' every '60' seconds.
return (60) -- you can change '60' from 1 to ?
end idle
... where you will substitute the '...' in 'tell application "..." to
quit' with the name of the 'Sybase ASA' background process name.
To save this AS Script - as an Applet, via the 'Script Editor's
'File, Save As...' Menu Item's Window - select 'Application' from the
'File Format:' popup menu, de-select the 'Options:' 'Startup Screen'
check box - if checked, and place a check mark in the 'Options:'
'Stay Open' check box.
You can optionally add the Applet to your 'System Preferences'
'Accounts' 'Startup Items' Tab's list, so as to have the Applet
launch each time the Mac is rebooted [restarted] or turned ON.
-----
I tried the above individual lines of code and the Applet code on a
few processes / applications, and they worked. However, I cannot say
the code will work with all processes.
--
SJWL
_______________________________________________
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.