• 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: Creating a New File In a Folder with WriteRoom
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Creating a New File In a Folder with WriteRoom


  • Subject: Re: Creating a New File In a Folder with WriteRoom
  • From: "koenig.yvan" <email@hidden>
  • Date: Sat, 22 Dec 2012 18:56:28 +0100


Le 22/12/2012 à 17:57, Patrick James <email@hidden> a écrit :


Hello

I had no problem with :

set currDate to current date
set yr to year of currDate as text
set mt to month of currDate as number
set dy to day of currDate
set hs to hours of currDate
set ms to minutes of currDate
set sc to seconds of currDate

set newName to yr & "-" & ¬
(text -2 through -1 of ("0" & mt)) & "-" & ¬
(text -2 through -1 of ("0" & dy)) & " " & ¬
(text -2 through -1 of ("0" & hs)) & "-" & ¬
(text -2 through -1 of ("0" & ms)) & "-" & ¬
(text -2 through -1 of ("0" & sc)) & ¬
".rtf"


set path2Doc to (path to documents folder as text) & "Diary:Latest:"
set path2Doc to (path to documents folder as text)  # your subfolders don't exist on my mac

tell application "System Events"
make new file at end of folder path2Doc with properties {name:newName}
end tell

set newFile to (path2Doc & newName) as alias

tell application "TextEdit"
activate
make new document
save document 1 in newFile
end tell

My best choice would be :

set newName to do shell script "date +'%Y-%m-%d %H-%M-%S.rtf'"

set path2Doc to (path to documents folder as text) & "Diary:Latest:"
set path2Doc to (path to documents folder as text)  # your subfolders don't exist on my mac
#set newName to (theDate & ".rtf") as text

tell application "System Events"
make new file at end of folder path2Doc with properties {name:newName}
end tell

set newFile to (path2Doc & newName) as alias

tell application "TextEdit"
activate
make new document
save document 1 in newFile
end tell

Yvan KOENIG (VALLAURIS, France) samedi 22 décembre 2012 18:56:00


 _______________________________________________
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

  • Follow-Ups:
    • Re: Creating a New File In a Folder with WriteRoom
      • From: Patrick James <email@hidden>
References: 
 >Creating a New File In a Folder with WriteRoom (From: Patrick James <email@hidden>)

  • Prev by Date: Creating a New File In a Folder with WriteRoom
  • Next by Date: Re: Creating a New File In a Folder with WriteRoom
  • Previous by thread: Creating a New File In a Folder with WriteRoom
  • Next by thread: Re: Creating a New File In a Folder with WriteRoom
  • Index(es):
    • Date
    • Thread