Jump to content
Server Maintenance This Week. ×

Create a directory with values from a filemaker 8 DB


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

Recommended Posts

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 by Guest
Link to comment
Share on other sites

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).

Link to comment
Share on other sites

  • 3 weeks later...

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"

Link to comment
Share on other sites

  • 1 year later...

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

Link to comment
Share on other sites

  • 6 months later...

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! :)

Link to comment
Share on other sites

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