Jump to content
Sign in to follow this  
Toby B

Pasting a variable from Applescript into a find request

Recommended Posts

I have a scriptmaker script to enter find mode which my Applescript calls. I then want the applescript to set a field in the find request to a string variable held in my applescript at which point the applescript will call another two scriptmaker scripts that performs the find and deletes found records respectively.

I tried doing this all in applescript but I am not yet up to scratch on FM language keywords and syntax for applescript.

Where I am going wrong is in the following code when I try to set the "MACAddress" field. I keep getting an error saying "Can't get or set "MACAddress" to "VariableContents"

tell application "Finder"

activate

my GetMACAddressFromName(the_item)

move the_item to folder DPImportFolder

tell document FMLaunchFileName of application "FileMaker Pro"

activate

do script FileMaker script "Open ASP Desktop Printers Database"

set theRequests to the_item_MACAddress as string

tell document "ASP Desktop Printers" of application "FileMaker Pro"

activate

do script FileMaker script "Enter Find Mode"

set contents of field "MACAddress" of current record to theRequests

do script FileMaker script "Perform Find"

do script FileMaker script "Delete Found Records"

end tell

end tell

my DPImport(the_item)

end tell

Share this post


Link to post
Share on other sites

To perform a find in FileMaker using AppleScript, I'm using someting like this :

tell application "FileMaker Pro"

delete every request

set newrequest to create request

set cell "Name" of newrequest to "Hoornaert"

find

end tell

You can create multiple requests

tell application "FileMaker Pro"

delete every request

set newrequest to create request

set cell "Name" of newrequest to "Hoornaert"

set newrequest to create request

set cell "First Name" of newrequest to "Rapha

Share this post


Link to post
Share on other sites

Not sure if this will do it but here's the usual syntax:

tell application "FileMaker Pro"

activate

open file "SomeHardDrive:SomeFolder:SomeDB"

show (every record of database "SomeDB" whose cell "SomeField" = SomeVariable)

end tell

Share this post


Link to post
Share on other sites

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
Sign in to follow this  

×

Important Information

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