Re :Re: date works with literal, but not otherwise
Re :Re: date works with literal, but not otherwise
- Subject: Re :Re: date works with literal, but not otherwise
- From: Jim Marsh <email@hidden>
- Date: Sun, 20 Dec 2009 17:33:06 -0400
Hi Bernard,
Ahhh ISorry for misinterpreting your goal here. The problem is that AS dates and NSDate objects are not interchangeable and you are getting an NSDate object I believe in your reply.
There is a very good thread over at MacSripter.net that delves into this just search for the topic:
working with NSDate objects
I had this issue regarding the components of NSDates and AS dates and this thread helped me solve it.
Regards, Jim ------------------------------------------------------------
Hi Jim
thanks for your help.
I need to deal with the date object, that's the crucial point here. i need something like this. it returns the correct weekday in AS-Editor, but the error in XCode:
set ThisMonth to "Januar" set kalenderJahr to "2010" set dateString to "1. " & ThisMonth & " " & the kalenderJahr & " 00:00:00" try set wochenTag to (weekday of date dateString) as string on error display dialog "ERROR: weekday of date " & dateString end try display dialog wochenTagHi Bernhard,
The reason for the error seems to be that you are returning a date object in your "set myDate1 to date dateString" but it appears you want a string.
I tried this and it worked.:)
set dateString to "Montag, 7. Dezember 2009 00:00:00" set myDate1 to dateString try display dialog "myDate1: " & myDate1 as string on error errText number errNum display dialog errText & " " & errNum end try
Regards, Jim -------------------------------- Hi List
In AppleScriptEditor, the following code displays the correct date
set dateString to "Montag, 7. Dezember 2009 00:00:00" set myDate1 to date dateString try display dialog "myDate1: " & myDate1 as string on error display dialog "ERROR: read myDate1" end try
In AppleScriptObjC however, it displays the ERROR message. When i change the first two lines to one single line:
set myDate1 to date "Montag, 7. Dezember 2009 00:00:00"
There is no Error Message.
I don't quite understand why this is the case. Can anyone help me please?
Thanks, Bernhard |
|
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescriptobjc-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden