Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

This topic is 4834 days old. Please don't post here. Open a new topic instead.

Recommended Posts

Posted

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

Posted

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.

Posted

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?

Posted

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

Posted

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

Posted

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"

Posted

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 )

)

This topic is 4834 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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.