In AppleScript Studio / Xcode 2.0 (461) on Mac OS X 10.4, closing a window (either programmatically or by clicking the close widget) causes the window to lose its AppleScript information. It will no longer respond to the events it is linked to (such as “will open” or “will close”) and its AppleScript name property is changed to its title property. This seems like a major bug and has halted my AppleScript Studio development for 10.4 completely. Help!
on 5/4/05 11:52 PM, John Coelho at @apple.com wrote:
Hi Jon,
This is a known bug that we have a fix for already and should be
available a future release. Here are some relevant notes from the
Tiger AppleScript Studio release notes:
In Tiger, the “Release when closed” NSWindow attribute in Interface
Builder is not honored. The window object is always released
regardless of how this attribute is set.
The workaround is not to close the window, but instead to hide it if
you want to keep it around. You can do this by adding an on should
close handler to your application as shown in the following example:
on choose menu item theObject
show window “Main”
end choose menu item
on should close theObject
hide window “Main”
return false
end should close
The lesson? Read the release notes. The AppleScript Studio release notes are buried and I just read the Xcode release notes. Hopefully this will help someone else.