Applescript Question

39 views
Skip to first unread message

Brian Dickerson

unread,
Aug 19, 2013, 10:32:02 AM8/19/13
to multiad...@googlegroups.com
I have a client that is trying to script the print dialog box. They would like to have custom page sizes saved that would match the ad sizes they are creating. If you run this script it would preselect the custom page size that matches the document size. I've been doing research but haven't been able to find anything that can control the OS print dialog with a script. Would anyone have any suggestions? Thanks. 
Message has been deleted

robbuck01

unread,
Aug 19, 2013, 5:34:22 PM8/19/13
to multiad...@googlegroups.com
Hey, guys

Basically, I would like my script to set the Paper Size of the document to automatically fit the ad canvas size of the document.

I've attached a few images so others can better understand what it is I would like this script to do.

First Image: Window to be scripted (specifically, the Paper Size drop down box):
Second Image: Ad before script is running (default paper size indicated by blue box)
Third Image: Ad after script is running (paper size, aka blue box, now fits exact size of the ad)

If anyone knows the best way to make this action scriptable, please let me know. Thanks.

Steve Mills

unread,
Aug 19, 2013, 6:05:28 PM8/19/13
to multiad...@googlegroups.com
You can't script the Page Setup or any of the popups in it. Well, you can if you use the UI scripting stuff, but that's a bitch to figure out and use. But you can do what you need, but you need to print in order for the size to "stick" in the document. Simply setting the paper size in the document won't do it. Sending the value along to the "print" command will force that value to be used. You can just print to pdf from there or anything else except canceling.

tell application "MultiAd Creator Pro"
activate
set syz to size of page 1 of document 1
set page options of document 1 to {page position:{horizontal position:at left, vertical position:at bottom}}

print document 1 print settings {custom paper size:syz, use custom paper size:true} with interaction
end tell

I recall that trying to work with the print manager had lots of roadblocks, and this might be one of them. This will also only work for documents that use a single page size, as it grabs the size of the first page. If it doesn't end up in the right location on the paper, you'll need to mess with the "page position" values in the "page options" property.

--
Steve Mills
Drummer, Mac geek


Rob Buckingham

unread,
Aug 22, 2013, 4:20:57 PM8/22/13
to multiad...@googlegroups.com
This is good.

I just wish there was some way to make that blue box re-size itself to the canvas as well. You know. To "clean it up a bit" :) But if there isn't a way then I suppose this will have to do.

Thanks much.
Reply all
Reply to author
Forward
0 new messages