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

Creating a New File In a Folder with WriteRoom


  • Subject: Creating a New File In a Folder with WriteRoom
  • From: Patrick James <email@hidden>
  • Date: Sat, 22 Dec 2012 16:57:59 +0000

Hi

I'm trying to create an AppleScript to create a new WriteRoom file with the current date and time as its title. In fact this is for my diary entries (it is so important that I record my wild hedonist lifestyle spent partying with international superstars).

I am using Mac OS 10.8.2.

I think the problems I am encountering relate to sandboxing and/or versioning. I've done quite a bit of googling and the script at present is as follows:

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

set theDate to yr & "-" & ¬
(characters -2 through -1 of ("0" & mt)) & "-" & ¬
(characters -2 through -1 of ("0" & dy)) & " " & ¬
(characters -2 through -1 of ("0" & hs)) & "-" & ¬
(characters -2 through -1 of ("0" & ms)) & "-" & ¬
(characters -2 through -1 of ("0" & sc)) ¬
as text ¬


set path2Doc to "boss HD:Users:pat:Documents:Diary:Latest:" as text
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 "WriteRoom"
activate
make new document with properties {name:newName}
save document 1 in newFile
end tell

This creates a new document opened with the date/time name but there is a big problem.

If I try to write in the document I get a dialogue saying:

You don't own the file "[filename]" and don't have permission to write to it.

You can duplicate [etc]

If I close the document and then reopen, either in WriteRoom or TextEdit, then I can edit it.

However, it is obvious that I wish to just write straight into the opened document, not have to close it and reopen it.

If I change the line:

tell application "WriteRoom"

to:

tell application "TextEdit"

the behaviour is the same except now of course I am dealing with a TextEdit document.

Thank you.



Patrick

 _______________________________________________
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: "koenig.yvan" <email@hidden>
  • Prev by Date: Renaming TV Episodes.
  • Next by Date: Re: Creating a New File In a Folder with WriteRoom
  • Previous by thread: Renaming TV Episodes.
  • Next by thread: Re: Creating a New File In a Folder with WriteRoom
  • Index(es):
    • Date
    • Thread