• 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
Re: Change Creation, Modified Dates
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Change Creation, Modified Dates


  • Subject: Re: Change Creation, Modified Dates
  • From: Michelle Steiner <email@hidden>
  • Date: Sat, 9 May 2009 11:28:08 -0700

On May 9, 2009, at 7:58 AM, Marconi wrote:

I'm stumped at extraction of the month, day and year from the text file of a dropped pair.

I broke it down to maybe more steps than what are needed, to show the logic involved.  That "T" between date and time caused a  bit of extra code to be needed.

on open (dropped_files)
repeat with this_file in dropped_files
tell application "System Events"
set extension to name extension of this_file
set file_kind to kind of this_file
set file_type to file type of this_file
end tell
if extension is "txt" or ¬
file_type is "text" or ¬
file_kind is "plain text" then
set foo to paragraph 1 of (read this_file)
if the first word of foo is "time" then
set bar to words 2 through end of foo
exit repeat
end if
end if
end repeat
set yr to item 1 of bar
set mo to item 2 of bar
set text item delimiters to "T"
set dy to text item 1 of item 3 of bar
set da_date to mo & space & dy & space & yr
set tim to text item 2 of item 3 of bar & ":" & item 4 of bar & ":" & item 5 of bar
set DTG to da_date & ", " & text 1 through -2 of tim
date DTG
end open

-- Michelle

--
Forget world peace.
Visualize using
your turn signal!

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

References: 
 >Change Creation, Modified Dates (From: Marconi <email@hidden>)

  • Prev by Date: Re: TextEdit, delete all blank lines
  • Next by Date: Re: TextEdit, delete all blank lines
  • Previous by thread: Change Creation, Modified Dates
  • Next by thread: Interacting with external shell scripts
  • Index(es):
    • Date
    • Thread