Re: Date pickers
Re: Date pickers
- Subject: Re: Date pickers
- From: Deivy Petrescu <email@hidden>
- Date: Wed, 10 Mar 2010 10:40:13 -0500
On 10/03/2010, at 10:04 , Craig Williams wrote:
>
> On Mar 10, 2010, at 6:14 AM, Deivy Petrescu wrote:
>
>>
>> On 09/03/2010, at 22:44 , Shane Stanley wrote:
>>
>>> On 10/3/10 10:58 AM, "Deivy Petrescu" <email@hidden> wrote:
>>>
>>>> However this does not!
>>>>
>>>> set zdate to (what_date's dateValue()) -- gets date value from date field
>>>> set d5 to 3600 * 24 * 5
>>>> return zdate's dateByAddingTimeInterval_(d5)
>>>>
>>>> -->Can’t make «class ocid» id «data kptr00000000A055590002000000» into type
>>>> Unicode text.
>>>>
>>>> I thought dateValue() would make zdate into an NSDate. Apparently I am wrong.
>>>
>>> It works fine here. I'd check you what_date connection in IB.
>>>
>>> --
>>> Shane Stanley <email@hidden>
>>> AppleScript Pro, April 2010, Florida <http://www.applescriptpro.com>
>>
>>
>>
>>
>> Thank you so much Shane.
>>
>> It does work. My error was happening in the log call.
>>
>> log zdate
>>
>> works, however
>>
>> log "This is " & zdate
>>
>> does not.
>>
>> The point is, when working in ASOC we are really in no man's land.
>> We are not using AppleScript and we are not using Objective-C...
>> We are doomed... :)
>>
>> Unfortunately this app has to be written in ASOC.
>> The next one will be Objective-C or some lower level language.
>> ASOC could be promising if there were a bit more of a guide.
>> By the way, I do appreciate all the information (thanks Shane) and the many web examples (thanks Craig).
>> A bit of light in this vast darkness.
>>
>>
>> Deivy Petrescu
>> email@hidden
>
> You're welcome.
>
> The reason that
>
> log "This is" & zdate
>
> does not work is because you have an Objective-C NSDate object instead of a string representation.
> Just like you cannot do
>
> log (current date)
Now I see why it does not work.
But put your mind in AS (which should be the language that I am actually programming with...
Because of the above I would not write
log zdate
zdate is a date
>
> but instead must convert it to a string
>
> log (current date) as string
Which is the same as
log "Today is "& (current date)
that really does not work in ASOC's example above.
That is what I mean by no men's land.
>
> For your log, try this instead.
>
> log "This is " & zdate's description
Now, that is a nugget. I was trying to get description to work but I did not know how.
(I thought it was description())
>
> NSObject has the description method so it flows down to all classes that inherit from it, which is just
> about all of them. The description method return a string that represents the contents of the receiving class.
>
> I think the hardest part about learning AppleScriptObjC is learning Objective-C and knowing
> when you have an AppleScript object and when you have an Objective-C object. Once you
> understand that, knowing which methods to call and how to convert between them become easy.
I agree. The hard part is understanding to walk on the border where you not really in any particular side.
>
> Just remember, when calling an Objective-C method on an AppleScript object, you must convert it to
> an Objective-C object first. The same goes for calling AppleScript methods on an Objective-C
> object, convert it to an AppleScript object first.
This conversion has proven difficult for me.
> hth,
>
> Craig
It does a lot.
Thanks also for the youtube videos, but, I have one more question, how do I get the weekday of a date.
the functions I tried, I was not successful.
I tried (don't know if I did it right.
components:fromDate:
firstWeekday
setWeekday: --- but this is the opposite of what I want
Thanks
Deivy Petrescu
email@hidden
_______________________________________________
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