tirtza Posted March 26, 2003 Posted March 26, 2003 my script archives images. When it runs, every few hundred records I get an error - out of memory- clip2gif got an error- not enough memory. how can I modify my program so as not to get this error? do script "Copy Image Big to clipboard" -- copy the image field tell application "clip2gif" activate save clipboard in window delay 2 save window 1 in window 1 maximum size {144, 144} -- pixels AKA 2 inches set picture_var to content of window 1 close window 1 end tell --application "clip2gif" tell application "FileMaker Pro 5v3" activate --bring to front set cell FM_Image_Small_Field of record i to picture_var -- Add end tell
jfmcel Posted March 27, 2003 Posted March 27, 2003 You just need to alocate more memory to clip2gif. Select the clip2gif application and then Get Info>Memory under the Finder's File menu. It is possible that clip2gif has a memory leak. If that is the case, periodically quitting the application will solve the problem. You might want to migrate your applescript to GraphicConverter or use the scripting addition GraphicImporter (or apple's Image Capture scripting addition when you get around to using OSX.)
tirtza Posted March 28, 2003 Author Posted March 28, 2003 I allocated more memory to clip2gif and nothing changed. Periodically closng the application worked the first few times and then stopped working. I also tried restarting my computer several times which also did not help. Additionally, after a while it gave me the error every few records and then finally said that my file is damaged. Could my script be corrupting the records? I am including the full script : note - this script runs on all the records which contain an image. property FM_DatabaseName "Styles 99 Test" property FM_Image_Small_Field : "ImageSmall" tell application "Finder" open application file id "c2gf" end tell tell application "FileMaker Pro 5v3" activate --bring to front go to database FM_DatabaseName tell document 1 --document is the found set set record_count to count of records --count the found set repeat with i from 1 to record_count --looping through the found set go to record i --set picture_var to get data of cell FM_Picture_Field of record i -- chokes on eps files if cell "ImageBigIn?" of record i = "Yes" then -- if no do nothing try -- grab path: OK for path OK only set image_path_var to get data of cell "SKETCH" of current record --of document 1 tell application "Finder" set image_name_var to name of image_path_var end tell tell application "FileMaker Pro 5v3" activate --brin to front set cell "ImagePath" of current record to (image_path_var as string) set cell "ImageName" of current record to image_name_var do script "Set <Image Smail Updated> to today" end tell on error do script "Set <Date Image Smail Updated> to 2/1/2345" -- Add end try -- return do script "Copy Image Big to clipboard" -- copy sketch field tell application "clip2gif" activate save clipboard in window delay 2 save window 1 in window 1 maximum size {144, 144} -- pixels AKA 2 inches set picture_var to content of window 1 close window 1 end tell --application "clip2gif" tell application "FileMaker Pro 5v3" activate --bring to front set cell FM_Image_Small_Field of record i to picture_var -- Add end tell -- beep 2 end if -- cell "ImageBigIn?" = "Yes" then -- if no do nothing delay 2 end repeat --looping through the found set end tell --document 1 end tell
jfmcel Posted April 4, 2003 Posted April 4, 2003 I recommend that you scrap cliptogif and try using the giconvert command from the GraphicsImporter scripting addition. You can get the scripting addition at http://osaxen.com/graphicsimporter.html After you download the addition, place it in the scripting additions folder in the system folder. Replace this section of your script
tirtza Posted April 7, 2003 Author Posted April 7, 2003 I followed your steps and i got an error "expected end of line but found identifier " and it highlighted theImageData after giconvert
tirtza Posted April 7, 2003 Author Posted April 7, 2003 what should i call the application in my tell statement
tirtza Posted April 7, 2003 Author Posted April 7, 2003 ignore the last 2 posts. now i have an error- filemaker got an error don't support this parameter for this image format and it highlights the giconvert line
jfmcel Posted April 7, 2003 Posted April 7, 2003 You do not need to block the giconvert command in a tell statement, and it will not work in a filemaker tell block. If you need to use the command within filemaker tell block, place a "tell me to" in front of the giconvert command. I took a few minutes to rewrite your script. (I forgot an important element.) You should first construct a FM scriptmaker script that performs a find for all the records whose cell ImageBigIn? is yes. Then create a loop. Within the loop place a Perform AppleScript step and a Go to Next Record (exit after last record) step. Into the Perform AppleScript step, paste the following -- try -- grab path: OK for path OK only set image_path_var to get data of cell "SKETCH" of current record set oldDelm to AppleScript's text item delimiters set AppleScript's text item delimiters to ":" set image_name_var to last text item in image_path_var set AppleScript's text item delimiters to oldDelm set cell "ImagePath" of current record to (image_path_var as string) set cell "ImageName" of current record to image_name_var do script "Set <Image Smail Updated> to today" on error do script "Set <Date Image Smail Updated> to 2/1/2345" -- Add end try set theImageData to alias image_path_var set theSize to giget gi size image theImageData set X_dim to item 1 of theSize set Y_dim to item 2 of theSize if X_dim is greater than Y_dim then set theBoundingRec to {0, 0, 144, round (144 * Y_dim / X_dim)} else set theBoundingRec to {0, 0, round (144 * X_dim / Y_dim), 144} end if giconvert theImageData bounds theBoundingRec set picture_var to result set cell "ImageSmall" of current record to picture_var
Recommended Posts
This topic is 7902 days old. Please don't post here. Open a new topic instead.
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now