Re: Strange behaviour in Script Editor 2 beta (was: Finder scripting dies)
Re: Strange behaviour in Script Editor 2 beta (was: Finder scripting dies)
- Subject: Re: Strange behaviour in Script Editor 2 beta (was: Finder scripting dies)
- From: kai <email@hidden>
- Date: Sat, 18 Oct 2003 01:29:26 +0100
on Fri, 17 Oct 2003 15:34:03 -0600, David Crowe wrote:
>
What I have found is that sometimes a script will put up a dialog box
>
but it is virtually impossible to bring it to the front. Clicking on
>
windows that are visible just brings the window to the front, not the
>
application. Sometimes clicking on the Finder icon in the dock will
>
do the trick.
Right. I was just looking at this issue myself. Seems to be a problem
specifically with Script Editor 2 beta.
>
But I have gone through the motions of restarting only to have the
>
dialog box pop on the screen just after all the other applications
>
have quit!
>
>
I haven't quite figured out why this happens, but it is possible that
>
this is in a case where I don't have an activate before the "display
>
dialog" or when some time elapses and the Finder may lose its status
>
as frontmost.
It's not just the Finder here. If an application is activated - either
implicitly ('display dialog', 'choose folder/file', etc.) or explicitly
('activate') - and then an attempt is made to throw up a dialog in another
app (without an explicit 'activate' command first), then this quirky
behaviour starts to manifest itself.
My impression so far is that the dock will generally activate the app
calling for attention, but the more traditional method of manual activation
(i.e. clicking in one of the required app's windows) becomes increasingly
difficult to achieve.
The problem appears to increase as a session progresses. Only quitting and
relaunching SE2 seems to reset the process, so that you can start over...
>
This brings up an interesting question ... why doesn't Display Dialog
>
do an implicit activate (at least as a default behaviour). When is it
>
useful to do "display dialog" for a non-foreground application (and
>
have it stay that way)?
This is pretty much how it is in OS 9, where you can display a dialog in any
application and it will temporarily (and implicitly) activate - just to show
the dialog. After that, frontmost status is returned to the application
running the script.
I should mention that OS 9 doesn't perform like this after an explicit
'activate' command, when the application menu will flash an icon instead -
to indicate that another app is trying to display a dialog. (One way to
'cancel' the effect of an explicitly activated app is to re-activate the
script - explicitly.) This all seems to be pretty reasonable behaviour to
me...
However, getting back to the SE2 thing, the following script might help to
demonstrate the problem. The behaviour generally suggests to me that SE2 may
become locked in some recursive process from which it (and the hapless user)
cannot escape until quit.
If you can't follow the instructions displayed by this script, then your
copy of Script Editor 2 must be working better than mine...
-------------------------
-- Run in Script Editor 2 beta (freshly launched):
set c to " click \"OK\" "
set s to "Please" & c & "- then click "
set e to " in Script Editor's window..."
set w to "once"
set b to "*twice* (pausing after the first click)."
set r to {"Perfectly Normal", "Really Spooky"}
set i to 1
set j to 2
repeat with n from -1 to 10
if n < 1 then
if n is 0 then
set b to "again."
set j to 1
end if
set n to 1
else if n > 1 then
if n > 2 then
set w to "*" & n & " times*"
else
set i to 2
set w to "*twice*"
end if
end if
tell application "Finder" to display dialog s & w & e with icon i
display dialog "Now" & c & b with icon j
end repeat
display dialog "Now how weird is that?" buttons r with icon 0
-------------------------
---
kai
_______________________________________________
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.