bcooney Posted November 21, 2009 Posted November 21, 2009 My goal is to Save As PDF to a new folder on the user's Desktop which I name(!) using a record ID, and this must work x-plat. I will be exporting additionally pdfs to this folder for a grand total of about 5 pdfs. I'm aware of JMO's export of a zipped folder, but that does not let me name the folder dynamically (and will in fact overwrite the folder if it exists). I need a MakeDir function in FM (if only FTPeek's plugin worked on local directories, Jesse!), and I was hoping for a technique rather than using Troi (unless that's run on the server, we're trying to push all plug-in dependencies to server scripts). Many thanks to any and all ideas or empathy.
fseipel Posted November 21, 2009 Posted November 21, 2009 You should be able to use the ScriptMaster plugin for the purpose; it has a create directory example and is cross platform. Alternately you can have the script execute different logic for Windows/Mac, for Windows a send event to execute a DOS mkdir command would do the trick, whereas on Mac you'd tell Finder to create a new folder (sorry I'm a bit vague on latter; it's been a few years since I ran Macs).
Fenton Posted November 21, 2009 Posted November 21, 2009 Macs also have the mkdir command (showing common Unix heritage). Using a Perform AppleScript step, it would look like this: set DT to POSIX path of (path to desktop) set notes_folder to DT & "MorningNews/" do shell script "mkdir -p " & notes_folder -- p option creates subdirectories as needed, and suppresses an error if the folder already exists (it will not overwrite a folder) P.S. If the folder name has a space, you'd want to use: set notes_folder to quoted form of (DT & "MorningNews/")
bcooney Posted November 21, 2009 Author Posted November 21, 2009 (edited) I have no AppleScript experience, Fenton. I don't follow what you're saying at all, lol. Can you post a FM file that creates a folder on the desktop using Applescript, and that has the folder name equal to "MyFolder" & RecID? Maybe that'll give me a clue. PS: I feel unworthy of my iMac. PPS: I did work for an Apple Dealership for 10 yrs. and have the original rainbow logo mug to prove it! Edited November 21, 2009 by Guest
Fenton Posted November 21, 2009 Posted November 21, 2009 Here's an example file which creates a folder on your Desktop, using a folder name from a FileMaker field. I included both the "vanilla" AppleScript method and the AppleScript "do shell script" (using Unix command line) method. The hardest part is getting the quotes right in the FileMaker calculations. Alternatively you could just get the value from the field at runtime. The shell command is much shorter. It also has the advantage that it can create a hierarchy of nested folders, in several different ways. It can also get the user's desktop more easily, ie., "~/desktop" But it has the disadvantage that you have to know how to quote text with spaces. There is also a script to Export PDF (of itself) to that folder on the Desktop, creating it if needed. Folder_from_field.fp7.zip
bcooney Posted November 21, 2009 Author Posted November 21, 2009 Got it. Terrific. Hope I can return the favor. btw. I found this site, and right after I learn PHP, I'll learn AS. I also downloaded ScriptMaster. I should probably go that route because if I can use Matt's technique of combining PDFs using iText and ScriptMaster, then I can output one PDF to a folder on their desktop with watermarks, etc. Even if I don't combine the PDFs, it is x-plat and will allow me to do this as a server script.
Newbies Leo Charette Posted March 7, 2010 Newbies Posted March 7, 2010 Very nice example, Fenton... thank you! -- LC
Stickybeak Posted November 3, 2010 Posted November 3, 2010 This is a great solution. I kind of get it - but I dont want to create new folders on my desktop I would like to create them on my idrive....and I cant work out how I need to the set the switches and paramaters
Fenton Posted November 3, 2010 Posted November 3, 2010 I'm not sure what iDrive is (iDisk?). But it is fairly easy to modify the path to work on a mounted drive. I'll use the Unix example, as it's shortest and easiest. All mounted drives are in the hidden /Volumes/ directory, at the root of the startup drive. So, if the name of the drive is "Donuts", the path is: /Volumes/Donuts/ So, if my iDisk is named "Donuts", the AppleScript command would be: do shell script "mkdir -p /Volumes/Donuts/Public/" & quoted form of "folder name" That would create a folder "folder name" in my Public folder on my mounted iDisk. You just have to (carefully) modify the(a) FileMaker calculation, to produce the above (for your path).
Recommended Posts
This topic is 5484 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 accountSign in
Already have an account? Sign in here.
Sign In Now