Re: Simple newbie question
Re: Simple newbie question
- Subject: Re: Simple newbie question
- From: Axel Luttgens <email@hidden>
- Date: Tue, 13 May 2008 16:55:06 +0200
Le 13 mai 08 à 11:13, ba95 a écrit :
I must apologie if I have not made myself clear enough.
My initial mail started with:
----
Here comes a script
It launches 2 linked applications if they are not opened, and quits
them if they are (toggle).
--
I just want 2 linked applications to launch together (if they are
not opened) or quit together (if they are opened) with an AS.
Please find hereafter my understanding of your question.
-- Let's assume identical process and application names.
-- Otherwise, one should for example distinguish App1ApplName and
App1ProcName.
property App1 : "TextEdit"
property App2 : "Console"
tell application "System Events"
set App1IsRunning to application process App1 exists
set App2IsRunning to application process App2 exists
end tell
-- If App1 can't be launched (App2 can't be quit), don't launch App2
(quit App1).
try
-- Since App1 and App2 are linked, let's make sure both are quit
-- if at least one of those apps is running.
if App1IsRunning or App2IsRunning then
if App2IsRunning then tell application App2 to quit
if App1IsRunning then tell application App1 to quit
--Neither App1 nor App2 is running, so let's try to launch both.
else
-- Depending of the app, "launch" could be a better choice than "run".
tell application App1 to run
tell application App2 to run
end if
end try
HTH,
Axel
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden