Re: Obnoxious Script Editor 2
Re: Obnoxious Script Editor 2
- Subject: Re: Obnoxious Script Editor 2
- From: Nigel Garvey <email@hidden>
- Date: Sun, 2 Nov 2003 12:52:04 +0000
Rob Jorgensen wrote on Sat, 1 Nov 2003 21:44:39 -0500:
>
Howdy,
>
>
The following script, when saved as a stay open application, opens
>
the dictionary of the frontmost application in Script Editor 2.
>
During my tests, if I reopen the applet (click the script's icon in
>
the dock while the script is running), Script Editor, which is
>
already running, becomes visible but not active, blocking the
>
frontmost application that is still active according to the menus.
>
>
The weird part is that this behavior isn't consistent. Reopening the
>
script while switching back and forth between different apps
>
(scriptable and non-scriptable) doesn't always produce the unwanted
>
Script Editor behavior, and I can't detect a pattern.
Hi, Rob.
I get the same results using your set-up - OS 10.2.8 and SE 2.0 beta.
However, the effect only occurs if Script Editor is hidden at the time
the script reopens. It seems that when it's made visible (by being told
to open the file), its current windows come to the front even though it
itself doesn't. The dictionary window opens in the background. If Script
Editor's in the background, but visible, none of its windows covers the
frontmost window of the frontmost app. Similarly if Script Editor has to
launch to obey the 'open' command, its windows don't get in the way.
I don't know if you'll like this compromise. If SE 2.0 is hidden, it
covers the frontmost app briefly, but then retreats to the background:
>
on reopen
>
tell application "System Events"
tell application process "Script Editor"
if (it exists) and it is not visible then set visible to true
end tell
>
set visible of first application process whose
>
frontmost is true to false
>
set frontApp to first application process whose
>
frontmost is true
>
end tell
>
>
tell application "Script Editor"
>
open file of frontApp as alias
set visible of frontApp to true
>
end tell
>
end reopen
This last section is an interesting example of reference being passed
from one application to another. :-)
I tried your original script with Script Editor 1.9 and found that:
1) If SE 1.9's hidden when the script is reopened from the dock, it opens
the dictionary but remains hidden.
2) The script uses whichever version of SE is open when it (the script)
is first activated - even if that version is subsequently closed and the
other opened in its place.
3) If both versions are open when the script's first activated, it
prefers the one that was opened first.
4) If neither version is open when the script's first activated, it
prefers SE 2.0 - presumably because this is the default version on my
computer.
NG
_______________________________________________
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.