opening window on launch

hi i’ve been making an application with xCode and the Interface Builder, and whenever I debug it, the first and only window doesn’t come up.

on launch
                open window "postWindow"
end launch

should I have to do that? what’s happenning?

The easiest way is to click on the window to highlight it in the “MainMenu.nib” window. Then, in the “Info” window, go to the “Attributes” pane (cmd+1) and make sure that the “Visible at launch time” button is checked. This will make your window visible when the app launches.

There are circumstances where you want to uncheck the visible at launch button and do it programmatically instead. While you’re still editing the info for the window, go to the “Applescript” pane (cmd+7) and enter a name for your window in the “Name:” field… i.e. “postWindow”. This is the window’s applescript name, which is different from it’s title. Then, click on the “File’s Owner” icon in the “MainMenu.nib” window. Select a handler to attach to the file owner (application)… such as the “launch” handler. Then, select the script you wish to use to handle the event in the list below, and click the “Edit Script” button. You should be taken to that script, where a new handler for the one you checked has been added. Then add your code to it. For example, if you wanted to add a ‘launched’ handler to open a window at launch time, you’d end up with…

on launched theObject
	show window "postWindow"
end launched

FYI, it’s usually better to post asstudio questions to the applescript studio forum.