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
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!