Re: a script for saving text from the clipboard to a file
Re: a script for saving text from the clipboard to a file
- Subject: Re: a script for saving text from the clipboard to a file
- From: Paul Berkowitz <email@hidden>
- Date: Mon, 27 Mar 2006 22:02:08 -0800
- Thread-topic: a script for saving text from the clipboard to a file
On 3/27/06 7:20 PM, "Malcolm Fitzgerald" <email@hidden> wrote:
> On 28/03/2006, at 12:47 PM, Diane wrote:
>
>> I am a newbie trying to make an Applescript to attach to a FileMaker
>> button. I'm pretty stuck at this point. I have cobbled together a
>> script that runs in Script Editor but seems unacceptable to FileMaker,
>> which tells me "Expected end of line, etc. but found identifier." and
>> will not save my clumsy script (below).
>
> This is your problem:
>> write clipboard_contents to alias the_path starting at eof
>
> FMP defines WRITE in it's own dictionary and there is a clash because
> you are wanting to use Standard Additions write command
>
> You need to use the raw applescript codes for that command.
>
> Standard Additions read/write
> -- «event rdwrwrit» -- write
> -- «event rdwrread» -- read
>
> «event rdwrwrit» clipboard_contents to alias the_path starting at eof
A less cumbersome way to do it is to "farm" out the file writing to a
handler:
set f to open for access alias thePath with write permission
tell app "FileMake Pro"
set clipboard_contents to whatever
my writeToFile(clipboard_contents, f)
end tell
on writeToFile(someText, f)
write someText to f starting at eof
end writeToFile
Note that since you're writing to f outside an application tell block you
also need to set f to open for access outside any tell block. Otherwise,
AppleScript won't know what file you're talking about.
--
Paul Berkowitz
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden