August 25, 201114 yr Can some one please help me. I have a filemaker script which is used to scan documents into a folder. I do not have any applescript skills and don't know how to pass FM script variables to applescript. I have a variable $Scanpath which determines the path to the file and another $Filename which gives it a name How can I pass these values to Applecript My attempt which does not work is: set theScannerSetup to "Scan SS 1 BW US Letter Page" set pathToFolder to "$Scanpath" set fileNameBase to "$Filename" set fileNumber to 1 tell application "ScanTango" -- Scan a document scan with setup (scanner setup theScannerSetup) -- Create the filename set fullPath to pathToFolder & fileNameBase & fileNumber & ".pdf" -- Create the path to the save file set theSaveFile to fullPath save front document in theSaveFile close front document end tell Can some one tell me the right syntax Joseph
August 25, 201114 yr You cannot refer to Filemaker variables inside AppleScript. You need to either define the variables in AppleScript, using references to Filemaker fields or switch to calculated AppleScript.
August 27, 201114 yr Author Thank you I have very little applescript skills so I don't know how to do this. How can I tell applescript to grab a value from say gFilename?
August 27, 201114 yr How can I tell applescript to grab a value from say gFilename? Try: set fileName to cell "gFilename" The field needs to be on the current layout.
August 28, 201114 yr I highly recommend using calculated Applescripts in FM. I have printing routines that have AppleScript calling bash routines that get complex , understanding that AppleScript evaluates text is an important concept to grasp, and calculated Applescripts, as much as they're a real pain to write (what with the necessity of enclosing text in the Quote function and other issues), work quite well once written properly. RW
August 28, 201114 yr Author Try: set fileName to cell "gFilename" The field needs to be on the current layout. This didn't work I got a syntax error Joseph I highly recommend using calculated Applescripts in FM. I have printing routines that have AppleScript calling bash routines that get complex , understanding that AppleScript evaluates text is an important concept to grasp, and calculated Applescripts, as much as they're a real pain to write (what with the necessity of enclosing text in the Quote function and other issues), work quite well once written properly. RW Unfortunately I have little if any applescript skills so this is beyond me joseph
August 28, 201114 yr Try: set fileName to cell "gFilename" The field needs to be on the current layout. No; that's one of the great things about applescript and globals. They do NOT need to be on the current layout; or any layout. You need to know the name of the field; and the name of the table occurrence. The table occurrence does not need to have ANY layouts based on it. If a valid table occurrence name is "Contacts" then set fileName to cell "gFileName" of table "Contacts"
August 28, 201114 yr set fileName to cell "gFileName" of table "Contacts" Thanks, that's very useful (and entirely undocumented, AFAIK).
August 28, 201114 yr I highly recommend using calculated Applescripts in FM. I don't know of any advantages a calculated Applescript might have as such. I use it out of necessity, not by choice. BTW, writing a calculated Applescript is easier if you do it in a text field, then use the Quote() function to "encode" it for you. Another useful technique is to use a generic template and insert variables into it, e.g. Let ( [ template = "display dialog \"message\"" ; message = Get (CurrentDate) ] ; Substitute ( template ; "message" ; message ) )
Create an account or sign in to comment