Re: Problem saving a new file
Re: Problem saving a new file
- Subject: Re: Problem saving a new file
- From: Axel Luttgens <email@hidden>
- Date: Sun, 21 Oct 2012 11:49:19 +0100
Le 20 oct. 2012 à 17:30, Eric Robertson a écrit :
> [...]
>
> I was aware that you can't use a file alias for a non-existent one but I thought I'd read that while the dictionary of some applications specified that a file alias had to be used you could get by without using one. This doesn't work here and I see how you've got over this problem.
Hello Eric,
You are right: dictionaries are often a bit inaccurate when it goes about the way to specify a file; as a result, some trial and error is often needed...
On the other hand, it's always worth to have a look at the way an application behaves, since its scripting model usually tends to reflect that behavior.
In the case of TextEdit, the workflow is to ask for a new document (which is internally handled by TextEdit in some kind of limbo as far as the user is concerned), then to type some contents, and finally to save the document somewhere.
So, let's try to just mimic this:
tell application "TextEdit"
tell (make new document)
set its text to "This is sample text"
close saving in POSIX file "/Users/ericrobertson/Documents/New Notes.rtf"
end tell
quit
end tell
HTH,
Axel
_______________________________________________
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