Re: How do you make AppleScript App Behave as App
Re: How do you make AppleScript App Behave as App
- Subject: Re: How do you make AppleScript App Behave as App
- From: Graff <email@hidden>
- Date: Sun, 24 Oct 2004 01:15:58 -0400
Not sure what you are trying to do here. Do you want Big.app to launch
Little.app and have Little.app respond? If so you can pass messages
back and forth by way of handlers:
Little.app
----
ignoring application responses
tell application "Big"
LittleRan()
end tell
end ignoring
display dialog "I ran"
----
Big.app
----
on run
ignoring application responses
tell application "little"
run
end tell
end ignoring
end run
on LittleRan()
display dialog "Little ran"
end LittleRan
----
If you want Big.app to quit when Little.app is successfully launched
then either (a) have Little.app message Big.app to quit or (b) have
Big.app monitor the running applications and when Big.app sees
Little.app running have Big.app tell itself to quit.
Both methods assume that Big.app is saved as a "stay-open application"
(a)
Little.app
----
ignoring application responses
tell application "Big"
quit
end tell
end ignoring
display dialog "I ran"
quit
----
Big.app
----
ignoring application responses
tell application "Little"
run
end tell
end ignoring
----
(b)
Little.app
----
display dialog "I ran"
quit
----
Big.app
----
on run
ignoring application responses
tell application "little"
run
end tell
end ignoring
end run
on idle
tell application "System Events"
if (exists (every process whose name is "Little")) then
tell me to quit
end if
end tell
return 1
end idle
----
Oh, by the way, if you tell an application to launch then it will not
run what is in the run handler (or the default run handler if you
didn't specify one). You need to specifically tell the application to
run to have it do what is in the run handler.
- Ken
On Oct 24, 2004, at 12:16 AM, David Andrews wrote:
I would like a Big App (AppleScript) to launch or activate a Little
App (AppleScript), but the Little App does not behave as a "normal"
App, that is, it does not tell the Big App that it is running so the
Big App hangs until the Little App quits (which creates an error
within Little App -- perhaps another story? -- the error does not
occur if Little App is run alone). This is not the desired result.
If the Little App is specified within the Big App as a "normal" app
(say SimpleText), then the desired result happens, the Little App
launches or activates, the Big App continues and then quits leaving
the Little App running.
Little App:
---------------
on run
say "Little App begins to run now."
--continue run
display dialog "Just wait around" buttons {"ok"} default button 1
end run
---------------
Big App:
---------------
set theApp to "Little App" -- Applescript App
--set theApp to "SimpleText" -- Classic App
try
--ignoring application responses
tell application theApp to launch -- almost, in Dock, but does nothing
--tell application theApp to activate
--end ignoring
on error mess
display dialog "The error text:" default answer mess buttons
"coninue" default button 1
-- Little App got an error: Connection is invalid.
end try
say "Wait for Little App to run"
repeat
tell application "System Events"
set the_apps to the name of every application process whose visible
is true
end tell
if the_apps contains theApp then exit repeat
delay 1
end repeat
say "Little App is running"
---------------
Please offer a solution, if there is one, i.e., please try your
solution within the above scripts (my heads already fairly sore from
the various combinations of the above commented text and then some)
(;-/#.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden