Jump to content
Claris Engage 2025 - March 25-26 Austin Texas ×

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

Recommended Posts

Posted

I am fairly new to Filemaker Pro but tend to learn very quickly. I have purchased the Missing Manual book for Filemaker but still haven't found what I am really looking to do. Forgive me for my lack of Filemaker terminology at this point (it will improve), so I will type out what I am looking to do and hopefully someone will have a solution.

Using a button on the record page I would like to do the following:

1. Save the current record as a PDF file.

2. Name the said PDF file using the Order Number field result which would be a sequential order number, to a temporary folder or desktop folder.

3. Attach saved PDF file to email.

4. Email PDF file to same recipient each time this script occurs.

***Side note: A more advanced feature I would like to add is after STEP 2 would be to pause the script, show the current record in a preview and have a pop up message asking "are you sure?" with the option to click OK or CANCEL, then continue the script.*** I am not nearly as interested in this "side note" and really just want to get the above script created properly.

Thank you so much for all of your help and I look forward to posting more questions down the road.

Posted

THANK YOU SO MUCH FOR THE QUICK RESPONSE!

I have checked this file out and believe I have everything exactly as described. The script is kind of working but here is the error message I get when I initially run it:

"Order Number xxx" could not be created on this disk. Use a different name, make more room on the disk, unlock it or use a different disk.

The output file I have specified is: filemac:/Macintosh HD/Desktop/TEST/$fileName

Could this be where my error is?

Posted

The outfile name should be $path (or any $var). You declared the entire path first and then use it as the output path (typically the next step). I believe that is how I've done it in the demo, but I don't have time to look right now.

Posted

The outfile name should be $path (or any $var). You declared the entire path first and then use it as the output path (typically the next step). I believe that is how I've done it in the demo, but I don't have time to look right now.

I think I follow you but maybe it would be easier if I just copied and pasted all of my script lines to show you what I have:

Set Variable ---- Get ( DesktopPath ) & "Order Number: " & CR Tour Services::Order Number & ".pdf"

Save Records as PDF ---- file:Desktop/TEST/$fileName

Send Mail (which this portion works fine other than attaching the saved PDF file)

I don't know if this helps or not but I figured I would give it a shot. Obviously all of those dashes are not part of it, I was just denoting which line was what.

Thanks so much for all of your help. I have basically copied your script from the Invoice Demo -- I think!

Will be up for a while trying to "trial and error it".

Posted

Firstly, colons ":" are illegal in file names on Mac, so right there is a point of failure.

Secondly, the Set Variable step generates the WHOLE path to the file, there is no need to add to it again in the Save as PDF step (except you should add the "file:" prefix).

So it should be:

Set Variable ---- $fileName - "file:" & Get ( DesktopPath ) & "Order Number - " & CR Tour Services::Order Number & ".pdf"

Save Records as PDF ---- $fileName

Send Mail (which this portion works fine other than attaching the saved PDF file)

Posted

Firstly, colons ":" are illegal in file names on Mac, so right there is a point of failure.

Secondly, the Set Variable step generates the WHOLE path to the file, there is no need to add to it again in the Save as PDF step (except you should add the "file:" prefix).

So it should be:

Set Variable ---- $fileName - "file:" & Get ( DesktopPath ) & "Order Number - " & CR Tour Services::Order Number & ".pdf"

Save Records as PDF ---- $fileName

Send Mail (which this portion works fine other than attaching the saved PDF file)

Okay, that works perfect!!!!! Thank you so much!!! Now, how do I get it to attach to the email? It produces the PDF to the desktop and then creates an email but there is no attachment...

Thoughts?

Posted

Basically, specify $fileName in the attachment part of the Send mail step.

Posted

Basically, specify $fileName in the attachment part of the Send mail step.

OK, that worked perfectly!!! HOME RUN!!! YES!!! One last question as it relates to this...I have a folder on the Desktop called TEST and I would like all of the PDF's to be saved in there when this script is run. I have tried multiple specify output ideas but having no luck, in fact I am getting error message that I used to get before your "fix".

Thoughts on this? It seems like it should be simple. If I "get info" on the folder on the desktop, this is the location of the folder: /Users/billytrimble/Desktop

Thanks again for your help!!

Posted

Billy,

Set the $filepath to - "file:" & Get ( DesktopPath ) & "Test/Order Number - " & CR Tour Services::Order Number & ".pdf"

Posted

Billy,

Set the $filepath to - "file:" & Get ( DesktopPath ) & "Test/Order Number - " & CR Tour Services::Order Number & ".pdf"

PERFECT!!! I don't know why that doesn't seem logical to me but oh well, glad it works. I need a good starter course/tutorial on scripts - I mean really dumbed down, like what each section of the script is doing and why and then also a tutorial on why you would use certain scripts, as well as what order they are to go in (which that part is somewhat logical).

Thanks again for all of your help.

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