Save PDF on local server script

I want to create a directory with a script on a local server. The 'server' an old (headless) intel Mac Mini I have sitting under a living room table.

I've done this on a Windows machine with 'Google Drive File Stream' but I just can't seem to do the same at home with my Mac Mini. Well, thats not quite true, it works with 'inset' into a container but I want to create the file structure via a script that I can use to store large files associated with each record.

So I have a Mac Mini : Karl's Mac mini
On it is a share/folder : Documents which I mount on my desktop

I've exhausted every method I know to save 'anything' on the Network Drive but all I get is

"[my record name] could not be created on this disk. Use a different name, or make room on the disk, unlock it or use a different disk."

• The script sets the record's name field as : $name
• Then sets the path as : [$path & "###/Volumes/Documents/CT/Characters/" & $name & "/""]
(### represents every combination I have tried from Karl's Mac mini/Volume/Documents to filemac:/Volume/Documents... and numerous others.

• Then 'save as pdf, dialog off, current record, create folders on
But it fails every time.

I've dragged the mounted share into Terminal which gives me... [/Volumes/Documents]

But unless I use "insert into a container" it just wont work.

I want to hit a button that will create my desired folder path on the share [/Volume/Documents/CT/Characters/character name/

Which I can then open with another script and drag large files into that I neither wish to store in my database or on my Mac.

Any suggestions will be appreciated, Karl.

If I am not mistaken, save by url location was deprecated in 17 so object files must be physically stored in FMS rc data storage

Hopefully I am not :foot: :face_with_hand_over_mouth:
@AndyHibbs ?

Hi Cecile.
I'm using : 'save record as pdf' with 'create folders' turned on.

Let me make sure we're on the same page, I running a solution from my Macbook Air and saving large files to my old Mac Mini... there's no Filemaker Server involved and I doing all this at home where both my MBA and Mac Mini reside.

First, let me make sure I understand what you're trying to do.

The place you're trying to generate a new folder is inside FileMaker Server's own Documents folder, yes?

The place FROM which you wish to initiate that activity is your own local box, i.e., you intend to execute this action as a guest of the database as opposed to executing a server-side script?

And you have FMServer's "Documents" folder mounted on your (guest machine) Desktop? As /Volumes/Documents/ or something of that ilk?

Assuming I've got that much correct: can you manually make a new folder, or is the Documents folder mounted read-only?

If you can do it manually, you can also use Execute AppleScript within a script to do a shell script (i.e., command-line instruction like you'd type in the Terminal) to make a folder of a specified name at that path.

If you can't do it manually, nothing you do in FileMaker can either.

I'm assuming you've already heard the sermons about file sharing on FmServer?

You guys are on another level.
I'm simply running a filemaker solution [my database] on my Macbook Air via FM18. Then using ... "Save Record as pdf" with 'create folders' on, to create the folder structure and save the record as a pdf on my Mac Mini which is on my local network, there no FileMaker Server involved.

I've successfully accomplished this with 'insert file' into a container which creates the folders structure on my Mac Mini, but I was hoping to do this with a 'save as pdf' script and a button. I've done this on Windows but always fail with a Mac.

The end goal is to be able to go to a record to which I need to link to a large file, hit the button which will create the folder structure on my Mac Mini by saving a pdf of the record, there afterwards I can open the folder on my Mac Mini from my Macbook Air with another button with an 'Open URL' script.

I'm starting to think I aught to forget about this method and just use the container method... it might be best as I can then simply drag the file and drop them on the container where they'll be stored on my Mac Mini and I can open later with 'Open URL

Set Variable [$AS; Let (qmk = """; ; "do shell script " & qmk & "mkdir " & "/Volumes/Documents/NewFolderName" & qmk)

Perform AppleScript [$AS]

Now you can Save as PDF to the folder you just created.

Hi AHunter.
So FileMaker can't do this on a Mac but on Windows only?
Thank you for that but I think I'll try to use the container method though currently its replacing what is in the folder with anything else I drop into the container.

I like to know how something works which is why I keep away from Java and AppleScript. I know HTML5 and CSS3 rather well but have only used Apple's Automator a few times. If I'm pressed I'll use foreign code but I don't really want to add it to this file.

However, I do than you for offering it, it is appreciated.

Just to let you know I found a solution.

I've added a button [File Dump] on my layout.
Created a text field in the Character's Table called [Directory]

Then attached the following script to the button


If [IsEmpty ( A_Characters::Directory )]
Set Variable [$name ; Value: A_Chatacter::FullName
Set Variable [$path ; Value: “file mac:/Documents/CT/Characters/“ & $name & “/“ & “delete.pdf”
Save Record as PDF [Restore ; With dialog Off ; “$path” ; current record ; Create folders: On ]

Open URL [ With dialog off ; “file mac:/Documents/CT/Characters/“ & A_Character::FullName & “/”
Set Field [A_Characters::Directory ; 1 ]
Else
Open URL [ With dialog off ; “file mac:/Documents/CT/Characters/“ & A_Character::FullName & “/”
End If


If [A_Characters::Directory] is empty and the Network is mounted to allow the script to create "Delete.pdf' with its file path, the script will then give A_Characters::Directory a value of 1

Next time I hit the same button, the script finding that [A_Characters::Directory] has a value of '1' it will skip the creation part and just open the folder.


I found a blog where it explains how FileMaker can run a script to delete files on a local network which I can use to delete the file [delete.pdf], something I 'might' implement else I'll either leave the redundant file or manually delete it.

Additionally, I might add something to 'catch' an error if the drive isn't mounted so that either the script will mount it or I can do so manually.


Anyway, if I add those extra functions or not I have my solution and only have to hit a button to open my 'File Dump' residing on my Mac Mini.

As a side note, about a year ago I swapped the Mini's HD for a 1.5TB and its DVD drive for a 2TB which is use as myMac Mini's Time Machine, its worked out well just sitting there without a monitor sleeping until I need it to wake-up and backing up to is Time Machine whenever a change is made. Its worked out to be cheap and reliable NAS for under £100 and if I do need to access the OS... I do so via Mac's Screen Sharing App.

Update.
I abandoned using the 'Characters Name' to add, then referenced a number field with an auto-enter serial number instead, as some might have expected there were issues surrounding invisibles and certain characters signs.

God bless, Karl.

1 Like