• 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 Manipulation...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Applescript Date Manipulation...


  • Subject: Applescript Date Manipulation...
  • From: "Domains4Days.com" <email@hidden>
  • Date: Fri, 20 Dec 2002 18:00:16 -0800

Here's a quick script that puts the current date on the clipboard - And
manipulates some of the text.

right now it looks like:

Friday- December 20- 2002 5-54-00 PM

... But I would really like it to look like:

12-20-02 5-54-00 PM ( short version - PC friendly)

... Basically what I'm working very quickly - I like to use the above date
and time as a temporary file name.

Currently there are errors when using "/ or :" etc. - and also I don't
want to use these because they are unfriendly in the PC environment...

any help would be appreciated.


--- the script ---


set the message_text to ((the current date) as string)

set the message_text to replace_chars(message_text, ",", "-")
set the message_text to replace_chars(message_text, ":", "-")

on replace_chars(this_text, search_string, replacement_string)
set AppleScript's text item delimiters to the search_string
set the item_list to every text item of this_text
set AppleScript's text item delimiters to the replacement_string
set this_text to the item_list as string
set AppleScript's text item delimiters to ""
return this_text
end replace_chars

set the clipboard to message_text

--
RevDave
email@hidden

Check out some great Domain Names at:
http://www.domains4days.com
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Applescript Date Manipulation...
      • From: Richard Morton <email@hidden>
References: 
 >Re: Truncating month (From: "Domains4Days.com" <email@hidden>)

  • Prev by Date: Re: Quark "keep with next" property
  • Next by Date: Re: uh, that's so cool! AS 1.9.1
  • Previous by thread: Re: Truncating month
  • Next by thread: Re: Applescript Date Manipulation...
  • Index(es):
    • Date
    • Thread