Re: First Applescript
Re: First Applescript
- Subject: Re: First Applescript
- From: Gnarlodious <email@hidden>
- Date: Tue, 18 May 2004 16:14:37 -0600
-- script relaunchApplication
property theProcess : "Transmit"
on idle
tell application "Finder"
if not (exists process "theProcess") then tell me to launch
application theProcess
end tell
return (5 * 60) -- idle seconds
end idle
Notes:
The mailer breaks long lines, when you paste into a script editor unwrap any
lines that need it. in this case, " launch application" should not be
broken.
Replace "Transmit" with the name of your process. properties are available
from anywhere in the script.
Save the script "as application" and make sure to select "stay open".
Here's how a few of the components work:
tell application "Finder" to processes
-- > a list of all processes
tell application "Finder" to set allProcesses to processes
-- > allProcesses is now a variable
tell application "Finder" to exists process "Transmit"
-- > boolean
HTMS (Hope That Makes Sense)
-- Gnarlie's Applescript page
http://www.Gnarlodious.com/Mac/AppleScript/Page.html
Entity Web Manager spoke thus:
>
Hi List,
>
>
I must confess up front that I am a recent PC convert and that this is my
>
*first* task in Applescript. I don't really have an execution question yet
>
as much as an approach question. Here is what I want to accomplish.
>
>
I want to see if a particular process is running,
>
if the process is running I want the script to sleep for 5 minutes and try
>
again
>
if the process has stopped I want it to re-launch the associated application
>
sleep for 5 minutes and try again.
>
>
I can do this with AutoIT on the PC side no problem but since this is my
>
first Applescript I'm not sure what to do first, here is my question.
>
>
Do I actually have to open something like Terminal > run top > look for
>
'such&such process' and then manipulate it or can I just create an if
>
statement to accomplish the whole thing...
>
>
Something like this (pardon my ignorance):
>
>
if such&such process is running wait 5 minutes
>
else start such&such application and wait 5 minutes & loop
>
>
Thanks in advance,
>
>
Joshua
>
_______________________________________________
>
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.
_______________________________________________
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.