I have created a “datepicker” in applescript by selecting day, month, years, hours, minutes etc. as numbers from lists Is there a way - other than xcode - to produce an actual datepicker calendar/clock, or is the best way to use a user interface from xcode?
The reason for the question is that the process of going through five lists to produce a date for a calendar event takes too long, and if it can be done quicker, and more attractively, I would prefer to go that route…
AppleScript doesn’t provide a real date picker, if you need one, Xcode is the best choice.
Alternatively ask for a date string in a specified format like
set {text returned:textReturned} to display dialog "please enter a date in format yyyy/mm/dd hh:mm" default answer "2010/11/13 22:46"
I admit that this line needs a pretty complex error handling
I guess that I will have to go to the xcode route if i want to use a proper calendar/clock type of UI. I am not sure how you integrate an Applescript code into a cocoa App, but I assume that you have to use the results of the calendar picker to generate the variable names that you use in the Applescript, and then continue from there???
Sort of. As of Snow Leopard, you do this in AppleScriptObjC. There’s a catch in that Cocoa’s dates aren’t the same as AppleScript’s so there can be some fiddling, although there are simple workarounds. If you go to scriptbuilders, you’ll see a sample project in my ASObjC Utilities that doe this very thing.
Thanks for the info. I have downloaded your app, and I am trying to understand what is going on, and how I might be able to implement the datepicker portion. I will come back to you if I am having trouble…