• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag
 

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
AppleScript date
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

AppleScript date


  • Subject: AppleScript date
  • From: Joe Mac <email@hidden>
  • Date: Mon, 26 Jul 2004 03:21:54 -0700

I trying to make a simple AppleScript app so that I can input a date
into a NSTextField then have an Applescript use that text as a date.  I
am following the Display Dialog example for inputing into a text field.
  The problem I am having is converting the text in the text field to a
date.  There has to be something special about the way it takes the
actual text from the text field, because the applescript command:

set theDay to "08/29/1980"
set theDay2 to date theDay
-> date "Friday, August 29, 1980 12:00:00 AM"

works fine outside of Xcode, but when I try and turn the contents of
the text field into a date, I get errors.  I have tried different as
text, as date, as string after the code and nothing seems to work.
Here is part what I have in my script that doesn't work.

on clicked theObject
	tell window "main"
1.		set theDay to contents of text field "date"
2.		set theDay2 to date (text returned of theDay)

I get error:
Can't get +class ttxt; of "08/29/1980". (-1728)

or
1.		set theDay to contents of text field "date"
2.		set theDay2 to date theDay

I get error:
NSCannotCreateScriptCommandError (10)

I can edit out line 2 and I get no errors, but then its useless.  I
know you can have applescript prompt a dialog box to type in the text,
but I see no reason why this shouldn't work.

Any insight?  Would you like the whole applescript of maybe the whole
build folder... only 92k... I can post it on a website if you like.

Thank you

Joe Mac
_______________________________________________
xcode-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/xcode-users
Do not post admin requests to the list. They will be ignored.


  • Follow-Ups:
    • Re: AppleScript date
      • From: Philip Aker <email@hidden>
  • Prev by Date: Re: Slow and bloated?
  • Next by Date: Re: How can I get the source code?
  • Previous by thread: Newbie: Managing projects
  • Next by thread: Re: AppleScript date
  • Index(es):
    • Date
    • Thread