Updating the date

I’m sure there is a simple solution, yet, I always seem to over think things. Ok, here is the question. I am designing an Applescript application. When the application is opened, the date appears in a text field at the top. It works fine if I get rid of the old build and rebuild it again. However, if I build the application and run it as a stand alone app., (i.e. outside of Project Builder) it displays the date that it was built, not the current date that the app. is running on. Hope that makes sense. Here is the code to get the date and put it in the text box. I would try an update command, but I’m not sure how to use it.

property theDate : (current date)
on awake from nib
	set contents of text field "date" of window "mainWindow" to theDate
end awake from nib

Thanks in advance.

You are storing an unique date, so it will allways remain the same…
Try this instead:

on awake from nib 
   set contents of text field "date" of window "mainWindow" to (current date) 
end awake from nib

So it gets updated every run…

Actually, I think this may be a bit better if you want to use theDate elsewhere in your script:

This is related to the discussion in this thread.

Jon

Once again, you guys come through. I’ll try it on Monday when I get some time. I am in fact trying to use the date elsewhere in the program. I’m telling it to look at the date and if such and such is in the date, then do some acton.
Thanks.

Worked like a charm! Thanks again!