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.

Scripting PDF FM8

Featured Replies

I am trying to set a script variable to save a pdf file automatically. Here is the variable:

$filename = Get(desktoppatth)& "Filename.pdf"

The first problem I have is that instead of c:... all the are /. So, I created a field to substitute the / with . This seems to work. However, get the following error on my windows xp machine. "Documents and SettingsslmaccheDesktopFilename.pdf" could not be created on this disk.Use a different name, etc....

I believe it is taking the $filname and feeding it with the quotes, but I'm not sure.

I put in a show dialog to show what the variable is passing, and it is passing the correct

C:Documents and SettingsslmaccheDesktopSpecifications.pdf.

Any ideas?

Thank you very much.

I had the same problem - try this:

""" & Middle(Substitute (Get(DesktopPath) ; "/" ;"");2;Length(Get(DesktopPath))) & "specifications.pdf" & """

I then use the "send event" to open the file as above.

Strangely, Filemaker said that the at the start of the file was expected and not a bug???

FileMaker uses the [color:blue] (backslash) as an escape character within text strings in the calculation dialog. To insert a [color:blue]" (double-quote) into a text string, insert [color:green]". To insert a [color:blue] (backslash), insert [color:green]. To insert a [color:blue] (paragraph mark), insert [color:green]. The paragraph mark's character may not show properly in all web browsers...

Examples as they appear in a calculation:

To get the text [color:red]"This is a quote." enter it as [color:green]""This is a quote.""

To get the text [color:red]c:Documents and SettingsmeDesktop enter it as [color:green]"c:Documents and SettingsmeDesktop"

To get the text:

[color:red]This text is

on two lines. enter it as [color:green]"This text is¶on two lines."

Edited by Guest

  • Author

Thanks for the advice. I must still be doing something wrong as I am getting the same error. I'm not using a send event as I don't want to open the file, I just want to email it. I don't have to do anything funky for the mac side as the get(desktoppath) works fine there. It's only on the windows side that I have trouble.

Any other suggestions?

Thanks.

Just to knock the obvious on the head so to speak, is the folder you are trying to save to Read Only? I believe XP sometimes defaults to this when new folders are created. Just a thought.

  • Author

Yes, the folders are readable,but it still doesn't work.

Thanks.

kiwiora's tip worked for me to give the correct path. What specifically is not working? Can you show us the actual code?

I am a newbie to FM from Lotus approach.

Can you go through the entire process of naming a pdf? I have the page with the graphics, I even have the button to create the pdf. Now I just need to name that pdf with a combination of fields from 2 different tables and with the date.

OrgName TempName and current date 09-29-2005

Sample name would be.

FloridaStateUPlat09-29-2005.pdf

Thank you.

Jason

Has anyone been able to successfully save or export with a variable path yet?

I am also getting the same error.

I'm on a XP box.

Got it:

$filename = "filewin:" & Get ( DesktopPath ) & "specifications.pdf"

The trick was to read the dialog box put up by the Save Records as PDF script step. Right in front of our eyes and we missed it... I blame old age... ;)

Ahhh. I see. Sometimes its easy to over think things even tho when the answer is right in front of you.

Thanks again.

  • Author

Thanks so much. Works like a charm.

I played with the filewin before, but I had it in the wrong place.

Thanks again.

  • 2 weeks later...

Newbie,

Here's how I found to name a PDF file :)

Two step script, first define the script variable, second call the variable for your file name.

I've attached the png screen grabs for the mac, let me know if you need a PC friendly fm file.

Darrin.

Variable.png

PDFname.png

  • 3 weeks later...

Can you attach a pc friendly file or example on how to name the pdf's?

I don't think there's a whole lot of difference in the "name of the file", other than to not put reserved characters of that platform. Look at the dialog screenshots in mav's post. It shows examples of the file paths at the bottom. There is a difference in the prefix.

If you're exporting to (or below) the desktop the easiest thing is to use the new: Get ( DesktopPath ) function. I put the entire file path together as a calculation, in a script Variable, then just put that as the path.

Set Variable [ "$PDF_file";

Case ( Get ( SystemPlatform ) = -1; "filemac:": "filewin:" ) & Get ( DesktopPath ) & FileName & ".pdf" ]

Then in the Export dialog's path, only:

$PDF_file

  • Newbies

Pardon my ignorance, but what started as a eureka moment when I first read this post - a few hours down the track I am no closer to understanding the solution.

I am using Windows XP and I have tried to set the variable as per mav's explanation, but when I specify the output file as:

file:../Test Submission/$filename

What I get as my file name is: $filename.

My expected result is: SUB0004 031105.PDF

Thanks

David

  • Newbies

Ok, 6 hours later and I finally got it. It was a combination of all the solutions but the kicker was

filewin:$PDFFile

as opposed to the million other variations that I tried previously. What a great learning curve ;)

Thanks

  • 2 months later...

If I have two file references in the Save records as PDf step

1) filewin:$filename

2) filemac:$filename

will filemaker skip over the filewin reference on a mac or will it try that first, then move on the the filemac step?

Create an account or sign in to comment

Important Information

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

Account

Navigation

Search

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.