Set clipboard to Applescript variable?

Ultimately I am trying to set some Filemaker fields to Applescript variables. I would prefer a more direct method if you know one, but I’m hoping that I could at least set the clipboard to the variable, then paste the contents into the field.

So, how can I set the clipboard to “OriginalName” or to “xres” or “yres?”

set this_file to choose file
try
tell application ‘Image Events’
launch
– open the image file
set this_image to open this_file
– extract the property value
copy the dimensions of this_image to {xres, yres}
copy the name of this_file to originalname
– purge the open image data
close this_image
end tell
display dialog ‘The file ’ & (originalname as string) & ’ Resolution is ’ & (((xres as string) & ’ by ’ & yres as string) & ’ pixels’)
on error error_message
display dialog error_message
end try

Hi,

Use ‘set the clipboard to’:

set myVar to "Some stuff I picked up"
set the clipboard to myVar

And to read the clipboard:

set myOtherVar to the clipboard
display dialog myOtherVar

I don’t use or know much about Filemaker, but it is scriptable. Why are you not setting the Filemaker fields to the variables you have?

John M

:stuck_out_tongue: Got it!!

Since I was running the code from within Filemaker, I wanted to pass the data directly from within FM, but, duh, I need to do it via applescript!!

Here’s the code that works:

set this_file to choose file
try
tell application “Image Events”
launch
– open the image file
set this_image to open this_file
– extract the property value
copy the dimensions of this_image to {xres, yres}
copy the name of this_file to originalname
– purge the open image data
close this_image
end tell
tell application “FileMaker Pro”
activate
set field “Original Filename” in current record to originalname as string
end tell
on error error_message
display dialog error_message
end try

I just need to learn how to “Think” Applescript!!
Thanks!

Now, I can’t get Filemaker to accept the code into a Calculated Applescript. It doesn’t like the quotes.

Syntax is , or “”

Neither works. Any Ideas??

Thanks.

Quotes usually need to be escaped in some way. In AppleScript, of course, we use a backslash character:

run script "display dialog \"Hello World.\""

When I was doing a lot of database design work (many moons ago), I seem to recall using double quotes in FMP:

"display dialog ""Hello World."""

That may not still be the case ” but possibly worth a try…

Hello

Are you sure that you are using the correct syntax?

I work with this one:

	tell application "FileMaker Pro"
		create record at end of database 1 --nom_base
		set cell "désignation" of last record of it to designation
		set cell "chemin partiel" of last record of it to partiel
		set cell "décor" of last record of it to decorN
		set cell "modèle_texte" of last record of it to modT
		set cell "modèle_num" of last record of it to modN
		set cell "commentaires" of last record of it to komment

As you see, I don’t use field but cell.
This may be the soluce.

Yvan KOENIG (from FRANCE mardi 19 septembre 2006 15:43:15)