Techsurvivors

Archives => 2006 => Topic started by: JoeDu on June 07, 2006, 10:43:33 AM

Title: Applescripting
Post by: JoeDu on June 07, 2006, 10:43:33 AM
Anyone here good at Applescript?

Got a few issues trying to get a simple script to work....

Using OS9 (I know I know)
using FileMaker Pro 6

Trying to script the following....
Change default printer, then Page Setup to select a new paper size, then print, then switch the default printer back.

Anyone think they can help, or care to try?

Thanks!!
Title: Applescripting
Post by: bobw on June 07, 2006, 02:04:09 PM
A good place for scripting help;

http://bbs.applescript.net/
Title: Applescripting
Post by: JoeDu on June 07, 2006, 02:52:23 PM
Thanks! But, I already posted there, and two weeks later I don't have a single response.

Anyone here knowledgeable?
Title: Applescripting
Post by: bobw on June 07, 2006, 03:28:39 PM
Try here;

http://www.fmforums.com/forum/fusionbb.php?
Title: Applescripting
Post by: Xairbusdriver on June 08, 2006, 12:56:32 PM
Not much of an AppleScripter. And I skipped FM 6, going to 7 from 5. But, you should be able to set the desired printer while in FM using the Printer Setup menu ( that was in in OS 9, wasn't it? ). I think that setting will be kept for that FM file. But if you want to switch printers for different reports within a database, that won't work, as far as I can see. sad.gif Naturally, if you upgrade to FM 8 ( after upgrading the OS! ) you can have the print setup in a FM script ( manually or as a preset ). Hope you can get an AS answer, certainlt will be cheaper! :dancing:
Title: Applescripting
Post by: JoeDu on June 09, 2006, 10:18:27 AM
Appreciate the help, Bob and airbus. The FM link has a lot of good stuff. It will take me awhile...

meanwhile, here's my script so far:

QUOTE
tell application "Desktop Printer Manager"
   set default printer to desktop printer 2
end tell

tell application "FileMaker Pro"
   activate
   select menu item "Page Setup..." of menu "File"
   tell (print Setup of document 1)
      set PaperSize to "JOB JACKET"
   end tell
   print document 1
end tell

tell application "Desktop Printer Manager"
   set default printer to desktop printer 1
end tell


Switching the printer works. The problem is with the middle section, trying to change the page size. Nothing I've tried to activate the "Page Setup..." will work. I even have a system-level macro where "contol-P" activates the Page Setup... menu, but FM will not allow the "ketstroke" command.

Any clues?
Title: Applescripting
Post by: Xairbusdriver on June 09, 2006, 11:13:34 AM
The only suggestion I can make is to set the page size while within FM. While in List mode, then try printing, manually, again. If it works, the file should keep that setting ( hopefully ). Just this week, I noticed that a FM project I made for my wife was getting stuff near the margins clipped. I found that my wife had tried to print to a shared printer connected to my Mac. Simply selecting the printer she usually uses made things work, but not until I 'tweaked' some of the text on the page. Actually, I probably created the problem by designing the thing on my Mac which has the printer with narrower margins. Whan I put the files on her machine, I didn't check what printer ( margins ) it had. But unless she reads this post, I'll just blame her! rant.gif

But if you are trying to print different things on different printers from the same database, you may need to find a plug in that provides what you need. Still an extra cost, but cheaper than an upgrade.