Show Window from a menu item?

I’m trying to re open a window that has been closed through the File Menu. Why doesn’t this work?


on choose menu item theObject
	if the name of theObject = "nwind" then
		show window "main"
	end if
end choose menu item

I get: NSRecieverEvaluationScriptError

:confused: Aaron
xcode 2.1

Browser: Safari 412.2
Operating System: Mac OS X (10.4)

Browser: Safari 412.2
Operating System: Mac OS X (10.4)

I believe AS Studio unloads the window from memory when the user closes it. One solution is to make it invisible instead of closing it.

on should close theObject
	if name of theObject is "main" then
		set visible of window "main" to false
		return false
	end if
end should close

on choose menu item theObject
	if name of theObject is "nwind" then
		set visible of window "mywindow" to true
		show window "main" -- bring it to the front
	end if
end choose menu item

Ah… that makes sense. Thanks. :smiley: