Re: Problem saving a new file
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
Subject: Re: Problem saving a new file
Date: 20 October 2012 04:37:21 GMT+01:00
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