Re: Determining the 'nextmost' process...
Re: Determining the 'nextmost' process...
- Subject: Re: Determining the 'nextmost' process...
- From: Paul Berkowitz <email@hidden>
- Date: Fri, 01 Nov 2002 08:54:37 -0800
On 11/1/02 8:28 AM, "Peter Bunn" <email@hidden> wrote:
>
This has probably been patiently answered lebenty-leben times already,
>
but...
>
>
Is there a way - once a script (application) process has been launched
>
from a given 'frontmost' app - for the script to determine what that
>
(immediately previous) frontmost process was?
>
>
In this peculiar instance, a script _application_ must be used. (Though
>
I don't even know if an osas script, run from a menu, would avoid the
>
problem).
You could use a trigger script which does nothing but
tell application "Real Applet"
launch
run
end tell
which does nothing but launch the real app in the background and then quits.
Actually, to make sure it was working on the correct applet (arbitrary
applets tend to respond instead), you need something like:
property realApp : missing value -- will be an alias
if realApp /= missing value then
try
get realApp
on error -- it 's been deleted or moved to another computer
set realApp to missing value
end try
end if
if realApp = missing value then
set realApp to (choose file of type {"APPL"} with prompt "Where is the
Real Applet script application?")
end if
tell application "Real Applet"
launch
run
end tell
------------------------------
Then the Real Applet would begin
tell application "Finder"
repeat while exists process "Trigger Script"
end repeat -- just wait until Trigger Script, in the front, finishes
quitting
set frontProc to name of first process whose frontmost is true
end tell
tell application frontProc
-- your script
end tell
----------------------------
This will work as long as your script is truly "universal" using NO terms
specific to particular applications but only AppleScript terms (such as
'window' 'first', etc.) which compile outside any application context.
Otherwise, if you were in OS 9 or X, you would include
using terms from application "Whatever"
--script commands
end using terms from
around any such commands in 'if/else if' branches. But since you are still
in the antediluvian OS 8.6, you will need to use raw codes to get your
script to compile in a tell block to a variable. Those can be found using
Smile or Script Debugger. See the Smile Help. (Raw codes will also work in
OS 9 and earlier OS's.)
--
Paul Berkowitz
_______________________________________________
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.