Script Editor Bug Tracking Open Windows?
Script Editor Bug Tracking Open Windows?
- Subject: Script Editor Bug Tracking Open Windows?
- From: Jonathan Levi <email@hidden>
- Date: Fri, 09 Mar 2018 00:28:12 -0500
Hello,
I'm running into what appears to me to be a bug with Script Editor; I wonder if
this has been noted before.
Script Editor closes AppleScript windows appropriately when commanded; but it
appears to fail to update its list of open windows to reflect this fact; "get
name of windows" continues to show the closed window, and the count of open
windows is not decremented. Here's a short script that seems to illustrate this:
set fname to "zeroScript.scpt" (* Script with this name goes on the
Desktop; document contents consists of the single character 0.
*)
repeat with i from 1 to 3
openAndCloseWindowWithStats(fname, i)
end repeat
on openAndCloseWindowWithStats(fname, i)
log (return & "Opening and closing script window, cycle " & i)
logWindowCountsTwoWays(fname)
do shell script "open $HOME/Desktop/" & fname
logWindowCountsTwoWays(fname)
tell application "Script Editor" to close window fname
logWindowCountsTwoWays(fname)
end openAndCloseWindowWithStats
on logWindowCountsTwoWays(fname) (* counts open script windows as
determined by Script Editor app and System Events's Script Editor
process.
*)
tell application "Script Editor" to log ¬
"Application Script Editor: " & (count (windows whose name is
fname))
tell application "System Events" to tell process "Script Editor" to log
¬
"Process Script Editor: " & (count (windows whose name is
fname))
end logWindowCountsTwoWays
Here are the messages obtained by running the script:
(*
Opening and closing script window, cycle 1*)
(*Application Script Editor: 0*)
(*Process Script Editor: 0*)
(*Application Script Editor: 1*)
(*Process Script Editor: 1*)
(*Application Script Editor: 1*)
(*Process Script Editor: 0*)
(*
Opening and closing script window, cycle 2*)
(*Application Script Editor: 1*)
(*Process Script Editor: 0*)
(*Application Script Editor: 2*)
(*Process Script Editor: 1*)
(*Application Script Editor: 2*)
(*Process Script Editor: 0*)
(*
Opening and closing script window, cycle 3*)
(*Application Script Editor: 2*)
(*Process Script Editor: 0*)
(*Application Script Editor: 3*)
(*Process Script Editor: 1*)
(*Application Script Editor: 3*)
(*Process Script Editor: 0*)
For each cycle, after the first message the next two lines reflect window
counts by Script Editor and System Events's Script Editor process; next two
lines are the respective counts after a script window has been opened; next two
are the counts after the widow has been closed again. Script Editor seemingly
fails to track the window count correctly; the Script Editor process succeeds.
Jonathan
_______________________________________________
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