AnsweredAssumed Answered

How to capture a file or folder path?

Question asked by xcode on Oct 22, 2018
Latest reply on Oct 26, 2018 by xcode

Hi, I'm still learning a lot about using Applescript from within Filemaker pro (FMP13 - on a Mac). I had a simple idea of having a Filemaker script that would prompt me to navigate to a file or folder and once the item is selected the file path could be copied to a field in Filemaker.

 

The closest I've been able to get is by creating a Filemaker script that uses the "Perform AppleScript" function with the following bit of code. It's been tried with all field types without any success.

 

<><><><><><><><><><><

 

set myFilepath to choose file

 

tell application "FileMaker Pro Advanced"

 

set data cell "Test_My_Path" of current record to myFilepath

 

end tell

 

<><><><><><><><><><><

 

When I run the above code the following Filemaker ERROR is returned:

 

FileMaker Pro Advanced got an error: Can’t set cell "Test_My_Path" of current record to alias "Hardrive1:Users:apple:Documents:Letters:templates.txt".

 

Now the frustrating thing is I can see that filemaker has picked up the path of "Hardrive1:Users:apple:Documents:Letters:templates.txt" so I know the value is available. I would have even been happy to catch the Error Message Dialogue and copy that to a field which could then be worked on to extract the path.

 

I even tried to copy the output to clipboard hoping the value could be set in a field that way. Unfortunately that didn't work.

 

Right now I've exhausted all the ideas and suggestions I've picked up using Google so I'm hoping someone here might be able to suggest a few more ideas I could try before putting it in the too hard basket.

 

Thanks in advance.

Outcomes