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

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

Recommended Posts

Posted

Hi,

I'm a pure newbie to Mac (Mac OS X 10.8.3) and trying to a folder based on field data under a fixed path, but without any luck:

set dirName to cell "fk_person_id" of current record 

set targetPath to quoted form of ("/Volumes/Macintosh/cluster5/medistic/media/" & dirName) 

do shell script "mkdir -p " & targetPath

The above returns the below errors:
Object not found.
Unknown error: -1728.

What is wrong with my script, please help...

 

Posted (edited)

Do you want to perform this from within FileMaker? If so, you can use a direct field reference: 

List (
  "set dirName to " & YourTable::fk_person_id ; // note that this now is a FileMaker field reference  
  "set targetPath to quoted form of ( \"/Volumes/Macintosh/cluster5/medistic/media/\" & dirName )" ;
  "do shell script \"mkdir -p\" & targetPath"
)

Test the result of that expression (not this Filemaker code) in the (Apple)Script Editor.

Edited by eos
Posted (edited)
set dirName to "person_pk2fk_media::fk_person_id"
set targetPath to quoted form of ("/Users/cluster5/medistic/media/" & dirNAme
do shell script "mkdir -p " & targetPath

returns a folder as below (rather than the fk_person_id which should be 10001) :

person_pk2fk_media//fk_person_id

 

Any advice how to fix ?

Edited by mastichis
Posted

Well, if I'm correct I'm trying to run this in a Native AppleScript -to create a new directory. I dont even know if this is the correct approach as I'm not even a Mac user, I'm a Windows user, and all this doesn't really make sense to me.

The folder "person_pk2fk_media//fk_person_id" is created when script is run.

What should I change to create the correct folder name taken from the field "person_pk2fk_media::fk_person_id" ?

 

Posted

Well, if I'm correct I'm trying to run this in a Native AppleScript

​This is a Filemaker calculation; you need to specify the code as the calculation for the “Calculated AppleScript” option.

As noted before: try to evaluate this in the Data Viewer (in the correct context, i.e. person_pk2fk_media) and test the result in the AppleScript Editor.

Posted

As an aside: 

set dirName to cell "fk_person_id" of current record 

requires that the field "fk_person_id" be present on the current layout - otherwise you will get the error mentioned in the original post.

Posted

Ok, that made some sense -didn't pick it up at first. I got it working, putting it in the "Calculated AppleScript" as you said EOS and it worked!

Final working code:

List(
  "set dirName to " & person_pk2fk_media::fk_person_id ;
  "set targetPath to quoted form of (\"/Users/cluster5/medistic/media/\" & dirName)" ;
  "do shell script \"mkdir -p \" & targetPath"
)

Result:

/Users/cluster5/medistic/media/10001

 

Thank you all for helping out!

Posted

You could also use Base Elements Plugin to create folders at a path plus it will work on mac and windows

http://www.goya.com.au/baseelements/plugin

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