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

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


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

Recommended Posts

Posted

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]

Posted

Try using a global FIELD.

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

Posted

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
Posted

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

Posted

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

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

  • Like 2
Posted

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.

Posted

yourTO = your Table Occurrence

i.e. a table in your relationship graph.

  • Like 1

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