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

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

Recommended Posts

Posted

Okay, I'm a TOTAL Applescript virgin ... be gentle.

I have a client who wants to be able to switch between printing to her default printer, and printing to a pdf. The print dialog is disabled in all of her print scripts

On the PC, I can change FM's default printer by changing it in the Print Setup dialog. I've tried to do this in Panther, but the pdf-writer isn't available as a selection. Is there an applescript I could send her that would toggle between the two, or do I have to go out to her office and enable all of the print dialogs?

Thanks for any help you can provide.

Paul

Version: v6.x

Platform: Mac OS X Panther

Posted

PDF is built-in to OS X, so you don't really need PDF-Writer. All you have to do is click/choose the PDF, Save As PDF option in the Print dialog (any application can print pdf). If you save this setting in a Page Setup, Print script, then it be automatic, just like any other print setup.

Remember to drop down the FileMaker settings in the Print dialog, to be sure you're printing "Records being browsed" or "Current record."

You may want to leave the dialog on in the Print step, or else it's going to save whatever name file and location you entered when you created the script.

A more advanced method would be to go ahead and print to fixed name, no dialog, then change the name with an embedded AppleScript, using the value from a FileMaker field.

You would need a complete filepath to the fixed pdf file. You can calculate this as relative path from the active FileMaker file, using Status(CurrentFilepath). But you have to use Substitute to change the text to a Mac file path, result looks like:

"Macintosh HD:Users:Me:Documents:FileMaker:FM Clients:Power:Time:Power_Time.pdf"

This would be in an unstored calculation field, _cPDF_File. The new name would also be a field, either calculated or user-entered.

The following would be in a FM script, in a Perform AppleScript step, called after you print (with perhaps a small pause to allow the file to get created before you try and change the name; as this will happen very fast).

Ex.???

tell current record of document 1

set pdf_File to cell "_cPDF_File"

set newName to cell "pdf_Name"

end tell

tell application "Finder"

set name of file pdf_File to newName

end tell

Posted

Hey Fenton,

It sounds like no matter what I do, I'll be driving out to my clients office. I think she will have all the functionality she wants if I just enable the print dialogs.

But I'll keep that snippet of AppleScript in my archives for future use. One of these days I'll learn that stuff.

Thanks,

Paul

  • 2 weeks later...
  • 2 weeks later...
  • Newbies
Posted

I tried downloading that Automate_Email.sit file that is listed on the Fusion Dzgn sight, and my Stuffit Expander will not decompress it.. do you have a working copy you could email to me? This is EXACTLY the solution to the problem I'm working on right now so it really interests me.... thanks a bunch!

PS: My address is steve(at)suggitt(dot)com.

Thanks again

FileMaker Version: 6

Platform: Mac OS X Panther

Posted

AM I right that if a user prints a hard copy then the preset to "print to PDF" wont come up automatically next time a PDF script is run?

Posted

generica said:

I tried downloading that Automate_Email.sit file that is listed on the Fusion Dzgn sight, and my Stuffit Expander will not decompress it.. do you have a working copy you could email to me? This is EXACTLY the solution to the problem I'm working on right now so it really interests me.... thanks a bunch!

Yes I had that problem too

FileMaker Version: 7

Platform: Mac OS X Panther

Posted

I sent an emaul to the author and the download is fixed. However, the gist of the example is something we knew all along. In OSX, if you print to PDF and save the print settings, it will print to PDF next time.

Posted

Bruce -

Yes, while the gist is something we knew all along about saving the PDF settings it also includes the applescript to automate the name change of a file on the local machine. This was the intention of the file and the PDF printing was a bonus on OSX.

Sorry for not spotting the file error guys, but thanks to Bruce it is now fixed.

  • 5 months later...
Posted

I am having a problem with the part of the script that creates the PDF using the printing presets. In creating the PDF from within a FileMaker script (with only Page Setup and Print steps) I am told that I don't have enough memory for the operation, but if I just hit print instead and print using the same preset, it goes on to create the PDF without and error. Anyone have an idea why? confused.gif

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