Set Options for Printing [Example] Macro (v9.0.3)

MACRO:   Set Options for Printing [Example]

~~~ VER: 1.0    2019-10-23 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

Set Options for Printing [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.


ReleaseNotes

Author.@JMichaelTX

PURPOSE:

  • Set Preset Value in Print Dialog
    • Should work with all Apps that use a macOS standard Print Dialog

HOW TO USE

  1. First, make sure you have followed instructions in the Macro Setup below.
  2. Make App Window FrontMost that you want to Print
  3. Trigger this macro.
  • Macro will Pause Until Print Dialog is Shown
  1. If you get an error Notification, Copy full Notification, and post in reply below Macro Topic.

MACRO SETUP

  • Carefully review the Release Notes and the Macro Actions
    • Make sure you understand what the Macro will do.
    • You are responsible for running the Macro, not me. ??
      .
      Make These Changes to this Macro
  1. Assign a Trigger to this macro.
  2. Move this macro to a Macro Group that is only Active when you need this Macro.
  3. ENABLE this Macro, and the Macro Group it is in.
    .
  • REVIEW/CHANGE THE FOLLOWING MACRO ACTIONS:
    (all shown in the magenta color)

REQUIRES:

  1. KM 8.2.4++
  2. macOS 10.11.6 (El Capitan)+

TAGS: @Printer @AppleScript @UIScript

USER SETTINGS:

  • Any Action in magenta color is designed to be changed by end-user

ACTION COLOR CODES

  • To facilitate the reading, customizing, and maintenance of this macro,
    key Actions are colored as follows:
  • GREEN -- Key Comments designed to highlight main sections of macro
  • MAGENTA -- Actions designed to be customized by user
  • YELLOW -- Primary Actions (usually the main purpose of the macro)
  • ORANGE -- Actions that permanently destroy Variables or Clipboards,
    OR IF/THEN and PAUSE Actions

USE AT YOUR OWN RISK

  • While I have given this a modest amount of testing, and to the best of my knowledge will do no harm, I cannot guarantee it.
  • If you have any doubts or questions:
1 Like

you are right: robust is better.

thank you so much for a superb macro !

It works perfectly. Just in case you put it in the library, I added the following at the beginning:

image

I mistakingly thought that the printer selection can be defined in the preset. It appears that it must be selected separately. I have 2 printers, including one which is out of date but still working. (forget the label printer QL-700).

If it is not asking too much, would it be possible to add printer selection to the script. The printer is selected from a drop down list, analogous to and before the presets

2019-10-24_10-08-12

I would expect so. The AppleScript for the Printers Popup Button is:

set oPrintersBtn to pop up button 1 of sheet 1

You should be able to use the code for the PresetsBtn as a model:

        try -- works for most apps
          set oPresetsBtn to pop up button 2 of sheet 1
        on error -- needed for some apps like Chrome
          set oPresetsBtn to pop up button 2
        end try
        
        tell oPresetsBtn
          perform action "AXShowMenu"
          # set oUIElem to UI elements  ### for testing
          set oPresetToSelect to menu item presetName of menu 1
          tell oPresetToSelect
            perform action "AXPress"
          end tell
        end tell

Best to use Script Debugger 7 for development of UI scripts.

1 Like

thank you very much !

1 Like