November 11, 200520 yr Hello, Is it possible to have a button in my filemaker database create a set of directories on our file server (with the names of the directories determined by the values of a field from filemaker)? Also, I currently link to files on our server using the "open URL" script attached to a button. This works fine on Tiger (the web browser just passes and afp:// link to the finder), but on Panther it comes up as a page not found in the default web browser. Is there a better way to do this? Cheers, Edited November 11, 200520 yr by Guest
November 11, 200520 yr To create folders on a server the user (or the OS script triggered by the user) needs to have the necessary privileges to do that. other than that, it's entirely possible. 2 ways to go about it: - use a file plugin: very easy. Costs some money and you need to deploy the plugin - or use OS level scripting (AppleScript on Mac, VBscript on Windows=: free but you need to figure out how it's done on both platforms. check out the downloads section on my website for a VBscript repository (www.connectingdata.com).
December 1, 200520 yr Here is a bare-bones applescript to make a directory. Note -- this has no error checking, so be really careful until you are sure it is working! To test, remove the two dashes (--) on the "display dialog..." line, and add two dashes to the "set theResult" line. // Applescript --> Shell script which makes folders "tell application "Finder"¶" & " set cmd to "mkdir -p '" & $path & "'"" & ¶ & " -- display dialog "command" & return & cmd buttons {"OK"}¶" & " set theResult to do shell script cmd¶" & " return theResult¶" & "end tell"
April 20, 200718 yr You can simplify the above Applescript to a single line since you don't need any of the 'tell application finder' stuff from within FMP. - Create a new script and add a 'Perform Applescript' step. - Select 'Calculated Applescript' and hit the 'Specify' button. - Add this calculation: - "do shell script "mkdir -p ~/Desktop/'" & Get ( ScriptParameter ) & "'"" - Click 'OK' to exit the calculation and 'OK' again to exit the script. You can then call this script from any other script with your folder name as a script parameter. Alternatively you could replace "Get(ScriptParameter)" with "$somevariablename" or "" if you prefer. In this example I used ~/Desktop to specify the path although you could just as easily pass a full path as part of the script parameter or as a variable like this:- set variable $pathtocreate = "/Volumes/Local/MyFolder" "do shell script "mkdir -p '" & $pathtocreate & "'"" NB - It is important to notice the single and double quotes in the shells script, if you get these wrong it wont work! Hope this helps. Codeus
November 8, 200718 yr Codeus, I have a like situation and getting hung up on the single and double quote syntax in FM. I've set the variable for an CLI app that resides in a folder with the fm solution - Set Variable $path = CNSImage_File_GetPathToDB & "/bin/wacaw --VGA capture" - I'm using the CNS image plugin to return the path to the db, so if the user moves the solution folder around, we can always find the executable. I've verified that it's returning the correct path with Data viewer and I can paste it in Terminal and get the result I want. However, on the next script step Perform Applescript (calculated), "do shell script "$path"" I get nuthin'.... I know I've got to get single quotes in the calcuation, but damned if I can figure out where FM wants them. ?? TIA! :)
November 8, 200718 yr You've got to get the script variable outside the quotes; otherwise it's just text. "do shell script "" & $path & """
November 8, 200718 yr Thanks Fenton, I owe ya another one! I fear the day the FMForum gurus come to collect. What if they want me to kill someone? How could I possibly deny them? I shudder to think...
Create an account or sign in to comment