Jump to content
Sign in to follow this  
ade234

using applescript to pass a filename to Filemaker as variable - import records

Recommended Posts

HI,

I have an applescript that selects the name and path of an XML file that id like to then parse into filemaker.

I have tried using "Set Variable" to do this but cannot make the link between the applescript and $VariableName.

It is currently not working and is hard to find any examples on the web.

Any help is much appreciated.

It would look something like this. (which is SO NOT working)

Filemaker Script

Perform Applescript:


global file2open

set file2open to (choose file)

set file2openName to POSIX path of file2open

set $theFile to file2openName

Set Variable: [$FileToImport; Value: "filemac:/"& "$theFile"]

Import Records: [No dialog; $theFile; myxslt; Add; Mac_Roman]

Share this post


Link to post
Share on other sites

Try using a global FIELD.

I'm no AppleScript expert, but I'm sure I've seen this before.

Share this post


Link to post
Share on other sites

You can only set fields via AppleScript.

No Variables, no parameters for scripts.

Very much like it was introduced in FMP3.

Try this minimal demo.

aedemo.zip

  • Like 1

Share this post


Link to post
Share on other sites

Thanks Karsten,

That looks promising, a little backwards yes, but it looks like the only option.

How do I then bring that field in you demo back into the "import fields" dialog as the file path to import?

Cheers

Share this post


Link to post
Share on other sites

Same thing you would do if you weren't using applescript.

Set Variable: [$FileToImport; Value: "filemac:/"& yourTO::yourField

  • Like 2

Share this post


Link to post
Share on other sites

Hi,

Sorry, Im not familiar with yourTO::yourField .

A quick google didn't help much either. Please explain a little more the use of this cast.

Many thanks.

Share this post


Link to post
Share on other sites

yourTO = your Table Occurrence

i.e. a table in your relationship graph.

  • Like 1

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.