Jump to content
View in the app

A better way to browse. Learn more.

FMForums.com

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Create New Named Folder and Export to It

Featured Replies

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.

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

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/")

  • Author

Excellent! I will try them both.

  • Author

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 by Guest

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

  • Author

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.

  • 3 months later...
  • Newbies

Very nice example, Fenton... thank you!

-- LC

  • 7 months later...

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

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

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.