This follow-up is for future FHMX scripters looking for answers to the same issue.
I have spent hours trying to get FreeHand’s print menus and commands to work. This is what I have found:
Essentially, AS printing is kinda broke for FreeHand MX!
Using the “print” commands from the FreeHand dictionary is useless for FHMX. All you get is the print dialog window. You can press return to begin printing but no settings are applied. Using any other command with print (eg. Copies, SettingsFile, UsingDialog etc) makes no difference to the printed result.
You’re better off with UI scripting.
All elements of the FreeHand print windows can be UI scripted with the following exceptions. The Print Setup window tabs (in Advanced) for “Separations”, “Imaging” and “Paper Setup” cannot be clicked. I’ve tried using UI Browser to locate them but there is no AXPress action for these tabs (seen as unknown 1, 2 & 3) and location clicking just doesn’t work.
The only workaround I have is to get the script to request the user to click the various tabs - not elegant but it works. This is achieved by having the script look for a unique element from within each tab and try to get a value from it. If it returns an error (ie. the wrong tab is selected and therefore the element can’t be found) the computer says “Please click on the XXX tab” every few seconds. When the tab is finally selected and the value for the element can be obtained the rest of the UI scripting for that tab kicks in. This is an unfortunate interruption to the script but it may be worth the effort to someone.
Here’s a sample code of what I just described (for OSX10.4)
tell application "System Events"
tell process "FreeHand MX"
repeat
if (exists checkbox "Transverse" of UI element 1 of UI element 2 of window "Print Setup") then
exit repeat
else
beep 3
say "Please select the Paper Setup tab." using "Vicki"
delay 3
end if
end repeat
end tell
end tell
-- continue on UI scripting the elements for that tab
To simplify the UI scripting requirements you can set up FH Print Settings and have the script select the desired print setting. The Print Settings file seems to change all the dialog settings except for paper size when the document has been previously printed with the “Custom” paper setting. If, say, an A4 Print Setting is called (has A4 as the paper size) the doc will still print as Custom. So, UI scripting this bit may be a requirement if you’re likely to run into this trouble. We have this scenario pop up in our studio because the designers print to PDF for each client approval stage when they print a custom paper size PDF.
I’m suspecting that these issues won’t be fixed for a long while or at all (depending on what Adobe has in mind for FreeHand in the future). So this is all we have to work with for now unless someone else has a miracle solution.
Cheers,
Cojcolds