• 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: Problem saving a new file
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem saving a new file


  • Subject: Re: Problem saving a new file
  • From: Eric Robertson <email@hidden>
  • Date: Sat, 20 Oct 2012 18:23:23 +0100

From: Miguel Torikachvili <email@hidden>
Subject: Re: Problem saving a new file
Date: 20 October 2012 04:37:21 GMT+01:00
To: email@hidden


You can use this to set manually the file`s path, name and content every time the script runs:

set pathToDocuments to (path to documents folder)
set pathToFolder to (choose folder default location (pathToDocuments))
set nameFile to text returned of (display dialog "Set new file name:" default answer "New Notes.rtf")
set newFile to (pathToDocuments & nameFile as string)

tell application "TextEdit"
activate
make new document with properties {path:newFile}
set text of document 1 to text returned of (display dialog "New file content:" default answer "Simple test")
save document 1 in newFile
quit
end tell

That's an interesting way of doing this - it let's me select a folder in Documents if I want to. However in the set newFile line shouldn't it be pathToFolder rather than pathToDocuments, to allow for the folder I've selected in Documents? If I make this change though the make new document line doesn't work while if I make a new folder in the choose folder action the set newFile line doesn't seem to work.

Eric

 _______________________________________________
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

  • Prev by Date: Re: Problem saving a new file
  • Next by Date: Re: Problem saving a new file
  • Previous by thread: Re: Problem saving a new file
  • Next by thread: Re: Problem saving a new file
  • Index(es):
    • Date
    • Thread