Reference a folder, not file
I'm wandering if its possible to store a reference to a folder, not just a specific file. And I don't mean a folder of files, but just the folder itself.
Using FMP11 & mac os
If you can use AppleScript it is certainly possible to interact with a folder and its files from FileMaker. But FileMaker itself cannot store a reference to a folder directly (like in a container field).
It is possible to "list folder", to see what files are in it; then do something with the files. It is possible to create folders, and move files into/out of them.
Hmm, ok. Thanks for that.
What about just storing the path to the folder, then a script to launch the folder in finder. Or getting the parent folder from a file in a container field, then launching that folder
Whoop Whoop. I got it!
I learnt a lot about scripting in filemaker too.
Cheers for pointing me in the correct direction!
Could you share your solution, with specifics?
Whoop Whoop is not very informative.
Haha, yeh. No bother.
I have a container field that references a file in the directory to open.
I then created a script:
Open Url[No dialog; "file:///Volumes" & Let ([CFilePath = GetValue(Get ( ScriptParameter ); 2);CLength = Length(CFilePath);CLastSlash = Position(CFilePath; "/"; CLength ; -1);CFirstSlash = Position(CFilePath; "/"; 0; 1);CBadPath = Left(CFilePath; CLastSlash)];Right(CBadPath; Length(CBadPath) - CFirstSlash + 1)) ]
When I was trying to work out how to do this, there was a lot of things saying pretty much that, but not what to do with them. For those that want to know (well, those who are learning):
Goto File->Manage->Scripts (well, on OSX)
Create a new script. Look in the left hand command browser for Open URL, and move to the list on the right. Then select the command you just added, and click the 'Specify...' button.
Then, on the dialog that pops up, click specify again.
Then type in your script. The following is an example for my machine. Customise to suit (#are comments. not sure if thats right. I added them for this post)
"file:///Volumes" & #this is the root directory for Mac osx local machine
#the following is a bit messyLet ([CFilePath = GetValue(Get ( ScriptParameter ); 2); #Get the filepath from a script param. Or this could be a table field (container)CLength = Length(CFilePath); #Get the length of the filepathCLastSlash = Position(CFilePath; "/"; CLength ; -1); #Get the position of the last slash, so we dont include the actual fileCFirstSlash = Position(CFilePath; "/"; 0; 1)] #Get the position of the first slash, to cut out the guff at the start
#This could probably be done with a Middle commandRight(Left(CFilePath; CLastSlash); Length(CBadPath) - CFirstSlash + 1)
And thats it really.
If anyone has optimisation hints, fire in. If anyone has a more robust solution for cross-platform, then do say.
Retrieving data ...