I have recently completed an Apple Script studio application. It works find and does what I want, but it is slow to start and quit. I know why but I don’t know how I can improve it.
The main window has a large number of controls. When the application quits it uses the user default feature to save the state of the controls. (Check boxes, popup buttons and text fields) and when the application starts it reads in the state of the controls and sets them. I am using the “on will close” and “on will open” handlers to trigger these actions.
Thanks for the feedback. I have been busy on other things to get back to this immediately.
I have gained some improvement when quitting. I had stupidly put my writeSettings handler inside both the on will close and on will quit, so I have removed it from the on close.
The on finish launching handler gets called after the window is already visible. As a result it appears to be faster, because the window is displayed earlier and then you get to see all the controls set to their previously saved values. It is actually slower and this is because it is more work for the computer to update a control when it is visible than invisible.
My script was doing a similar thing, so I used the log command in my loadDefauts handler to track what was happening. From the log window I could see that my app was repeatedly loading the same defaults.
Using Interface Builder, I unchecked any unnecessary connections to my applescript, until my defaults only loaded once.