Close Window

Sorry if this is a dumb question but I am at a loss …
I’m creating an Applescript Application that uses multiple nib files. Each nib file holds a window of temporary information that I would like refreshed when the window hides. I have searched and can not find a way to close the window or close the nib file when I am done with it. Currently when I move between windows I am hiding them. Is there a way to close the window (to refresh the content) or close the nib instead of just hiding the window?

Model: iMac G5
Browser: Safari 417.8
Operating System: Mac OS X (10.4)

I’m not sure if this is what you’re after, but what I do is simply attach a “will open” handler to the window.
For example:

on will open theObject
tell window “query”
set string value of text field “componentField” to “”
set string value of text field “cellField” to “”
set string value of text field “shouldUseField” to “”
set string value of text field “usingField” to “”
set state of button “processPMSIssue” to 0
set state of button “wrongPMS” to 0
set state of button “inPCX” to 0
set state of button “rush” to 0
set state of button “notIndicated” to 0
end tell
end will open

When the window re-opens all values are set to zero.
Hope this helps.

Thanks for the response. I am making a kiosk application that uses an NSMovieView object that plays a unicast movie as a preview from Wirecast. It’s a very simply video recording station. The problem i’m experiencing is when I move to another window and eventually come back to the window and need to play the unicast movie again it won’t let me because for some reason only 1 instance of the movie can be open at a time. Even when I delete the movie from the NSMovieView and reload it the file will not play. The only thing that works is closing the application and then re-open it. I am looking for a way to refresh a nib file - or close a nib and then re-open it to completely dump all information in the nib. Is it possible to close a nib and the reload it? If you are able to load a nib shouldn’t it you also be able to close or unload it?

I read somewhere that you can check a box so that when a window is closed all information is dumped from it but when I do a “close window “thewindowtitle”” it doesn’t close the window… Is there a way to close a window without clicking with red close button at the top of the window?

So far my only solution is to run a script that closes my application and re-opens it so a user can start with a new session with a video preview NSMovieView window.


I’m not really familiar with what it is you’re trying to do specifically so perhaps someone else in the forum could better assist you in that regard. As far as mimicking the action of clicking the red button to close a window, I don’t know of any way to achieve that in AppleScript Studio other than by using the “Call Method” command.

on clicked theObject
call method “close” of (window of theObject)
end clicked