Jump to content

passing a script variable to applescript


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

Recommended Posts

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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"

Link to comment
Share on other sites

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 )

)

Link to comment
Share on other sites

This topic is 4619 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.