Save File to Desktop with Date in Filename

Discussion created by dchabot on Jan 11, 2012
Latest reply on Jan 12, 2012 by hostie42

Hi FM Guru's,


I've googled and spent way too much trying to get the date in a filename title saved as pdf to desktop.


Here's the script I'm using:


This is set in globals table in the same script just prior to calling Save As Pdf script.


Set Field [ Globals::_reporttitle; "Weekly Tax Report-12/30/2011" ]


Then this part of the script is called:


Set Variable [ $reporttitle; Value:Globals::_reporttitle ]

Adjust Window

[ Resize to Fit ]

Show Custom Dialog [ Message: "Save as PDF or Print?"; Buttons: “PDF”, “Print”, “Cancel” ] If [ Get ( LastMessageChoice )=1 ]

Show Custom Dialog [ Buttons: “OK”; Input #1: Globals::_reporttitle, "You may change the report title." ]

Set Variable [ $filename; Value:If ( Abs ( Get ( SystemPlatform ))=1;"filemac:";"filewin" ) & Get ( DesktopPath ) & Globals::_reporttitle & ".pdf" ]

Save Records as PDF [ File Name: “$filename”; Records being browsed ]

[ Document - Compatibility: Acrobat 7 and later ]

[ Pages - Number Pages From: 1; Include: All pages ]

[ Security - Printing: High Resolution; Editing: Any except extracting pages; Enable copying; Enable Screen Reader ]

[ Initial View - Show: Pages Panel and Page; Page Layout: Single Page; Magnification: 100% ]

[ Restore; No dialog ]

Show Custom Dialog [ Message: "The file has been saved to your desktop."; Buttons: “OK” ]

Else If [ Get ( LastMessageChoice )=2 ]

Print [ Records being browsed; All Pages; Orientation: Portrait; Paper size: 8.5" x 11" ]

[ Restore ]

End If


The 1st set field script for report title works fine.

The set variable $reportitle looks fine in the Data viewer.



Save file dialog title is always 'Weekly Tax Report' ignoring the date.

I've tried GetAsText (thedate) and numerous hours on google and FM- no joy!


I need to distinguish these reports by date because client will print 52 a year!


I humbly accept any insight into what is probably a very simple solution which totally pulls my hair out!



Using only Macs FMA 11