Skip to main content
added 66 characters in body
Source Link
markhunte
  • 12.3k
  • 1
  • 34
  • 55

UPDATE. this will work in 10.7.x but 10.6 has les element info.

The Buttons (drop downs ) in the Print Sheet have Description to describe the function.

In Accessibility inspector; you see this when hovering the mouse over the element (button). you can lock the Accessibility inspector's view with cmd+F7.

The Description will be listed as AXDescription

enter image description here

In the cases for the Printers its is Printers for Presets it is Presets

If you know the AXDescription you can avoid the numbers using something like this. But this is not the only way. Just one example.

activate application "Preview"
tell application "System Events"
    tell process "Preview"
        click ((pop up buttons of sheet 1 of window 1) whose description is "Printers")
    end tell
end tell

For the above to work in this example the Print Sheet must be visible along with 'Show Details'

The button/drop down has a menu. So you can select or click it by referring to the menu items of the menu of the button.

Either by number or using its title/AXTitle.

activate application "Preview"
    tell application "System Events"
        tell process "Preview"
            click ((pop up buttons of sheet 1 of window 1) whose description is "Presets")

click menu item "Last Used Settings" of menu of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        end tell
    end tell

You can shorten repetitive code by using a variable for the button and calling that. When doing it like my example below;

   activate application "Preview"
tell application "System Events"
    tell process "Preview"
        set Presets_button to item 1 of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        
        click Presets_button
        click menu item "Last Used Settings" of menu of Presets_button
    end tell
end tell

The Buttons (drop downs ) in the Print Sheet have Description to describe the function.

In Accessibility inspector; you see this when hovering the mouse over the element (button). you can lock the Accessibility inspector's view with cmd+F7.

The Description will be listed as AXDescription

enter image description here

In the cases for the Printers its is Printers for Presets it is Presets

If you know the AXDescription you can avoid the numbers using something like this. But this is not the only way. Just one example.

activate application "Preview"
tell application "System Events"
    tell process "Preview"
        click ((pop up buttons of sheet 1 of window 1) whose description is "Printers")
    end tell
end tell

For the above to work in this example the Print Sheet must be visible along with 'Show Details'

The button/drop down has a menu. So you can select or click it by referring to the menu items of the menu of the button.

Either by number or using its title/AXTitle.

activate application "Preview"
    tell application "System Events"
        tell process "Preview"
            click ((pop up buttons of sheet 1 of window 1) whose description is "Presets")

click menu item "Last Used Settings" of menu of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        end tell
    end tell

You can shorten repetitive code by using a variable for the button and calling that. When doing it like my example below;

   activate application "Preview"
tell application "System Events"
    tell process "Preview"
        set Presets_button to item 1 of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        
        click Presets_button
        click menu item "Last Used Settings" of menu of Presets_button
    end tell
end tell

UPDATE. this will work in 10.7.x but 10.6 has les element info.

The Buttons (drop downs ) in the Print Sheet have Description to describe the function.

In Accessibility inspector; you see this when hovering the mouse over the element (button). you can lock the Accessibility inspector's view with cmd+F7.

The Description will be listed as AXDescription

enter image description here

In the cases for the Printers its is Printers for Presets it is Presets

If you know the AXDescription you can avoid the numbers using something like this. But this is not the only way. Just one example.

activate application "Preview"
tell application "System Events"
    tell process "Preview"
        click ((pop up buttons of sheet 1 of window 1) whose description is "Printers")
    end tell
end tell

For the above to work in this example the Print Sheet must be visible along with 'Show Details'

The button/drop down has a menu. So you can select or click it by referring to the menu items of the menu of the button.

Either by number or using its title/AXTitle.

activate application "Preview"
    tell application "System Events"
        tell process "Preview"
            click ((pop up buttons of sheet 1 of window 1) whose description is "Presets")

click menu item "Last Used Settings" of menu of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        end tell
    end tell

You can shorten repetitive code by using a variable for the button and calling that. When doing it like my example below;

   activate application "Preview"
tell application "System Events"
    tell process "Preview"
        set Presets_button to item 1 of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        
        click Presets_button
        click menu item "Last Used Settings" of menu of Presets_button
    end tell
end tell
added 547 characters in body
Source Link
markhunte
  • 12.3k
  • 1
  • 34
  • 55

The Buttons (drop downs ) in the Print Sheet have Description to describe the function.

In Accessibility inspector; you see this when hovering the mouse over the element (button). you can lock the Accessibility inspector's view with cmd+F7.

The Description will be listed as AXDescription

enter image description here

In the cases for the Printers its is Printers for Presets it is Presets

If you know the AXDescription you can avoid the numbers using something like this. But this is not the only way. Just one example.

activate application "Preview"
tell application "System Events"
    tell process "Preview"
        click ((pop up buttons of sheet 1 of window 1) whose description is "Printers")
    end tell
end tell

For the above to work in this example the Print Sheet must be visible along with 'Show Details'

The button/drop down has a menu. So you can select or click it by referring to the menu items of the menu of the button.

Either by number or using its title/AXTitle.

activate application "Preview"
    tell application "System Events"
        tell process "Preview"
            click ((pop up buttons of sheet 1 of window 1) whose description is "Presets")

click menu item "Last Used Settings" of menu of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        end tell
    end tell

You can shorten repetitive code by using a variable for the button and calling that. When doing it like my example below;

   activate application "Preview"
tell application "System Events"
    tell process "Preview"
        set Presets_button to item 1 of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        
        click Presets_button
        click menu item "Last Used Settings" of menu of Presets_button
    end tell
end tell

The Buttons (drop downs ) in the Print Sheet have Description to describe the function.

In Accessibility inspector; you see this when hovering the mouse over the element (button). you can lock the Accessibility inspector's view with cmd+F7.

The Description will be listed as AXDescription

enter image description here

In the cases for the Printers its is Printers for Presets it is Presets

If you know the AXDescription you can avoid the numbers using something like this. But this is not the only way. Just one example.

activate application "Preview"
tell application "System Events"
    tell process "Preview"
        click ((pop up buttons of sheet 1 of window 1) whose description is "Printers")
    end tell
end tell

For the above to work in this example the Print Sheet must be visible along with 'Show Details'

The button/drop down has a menu. So you can select or click it by referring to the menu items of the menu of the button.

Either by number or using its title.

activate application "Preview"
    tell application "System Events"
        tell process "Preview"
            click ((pop up buttons of sheet 1 of window 1) whose description is "Presets")

click menu item "Last Used Settings" of menu of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        end tell
    end tell

You can shorten repetitive code by using a variable for the button and calling that. When doing it like my example below;

   activate application "Preview"
tell application "System Events"
    tell process "Preview"
        set Presets_button to item 1 of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        
        click Presets_button
        click menu item "Last Used Settings" of menu of Presets_button
    end tell
end tell

The Buttons (drop downs ) in the Print Sheet have Description to describe the function.

In Accessibility inspector; you see this when hovering the mouse over the element (button). you can lock the Accessibility inspector's view with cmd+F7.

The Description will be listed as AXDescription

enter image description here

In the cases for the Printers its is Printers for Presets it is Presets

If you know the AXDescription you can avoid the numbers using something like this. But this is not the only way. Just one example.

activate application "Preview"
tell application "System Events"
    tell process "Preview"
        click ((pop up buttons of sheet 1 of window 1) whose description is "Printers")
    end tell
end tell

For the above to work in this example the Print Sheet must be visible along with 'Show Details'

The button/drop down has a menu. So you can select or click it by referring to the menu items of the menu of the button.

Either by number or using its title/AXTitle.

activate application "Preview"
    tell application "System Events"
        tell process "Preview"
            click ((pop up buttons of sheet 1 of window 1) whose description is "Presets")

click menu item "Last Used Settings" of menu of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        end tell
    end tell

You can shorten repetitive code by using a variable for the button and calling that. When doing it like my example below;

   activate application "Preview"
tell application "System Events"
    tell process "Preview"
        set Presets_button to item 1 of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        
        click Presets_button
        click menu item "Last Used Settings" of menu of Presets_button
    end tell
end tell
added 547 characters in body
Source Link
markhunte
  • 12.3k
  • 1
  • 34
  • 55

The Buttons (drop downs ) in the Print Sheet have Description to describe the function.

In Accessibility inspector; you see this when hovering the mouse over the element (button). you can lock the Accessibility inspector's view with cmd+F7.

The Description will be listed as AXDescription

enter image description here

In the cases for the Printers its is Printers for Presets it is Presets

If you know the AXDescription you can avoid the numbers using something like this. But this is not the only way. Just one example.

activate application "Preview"
tell application "System Events"
    tell process "Preview"
        click ((pop up buttons of sheet 1 of window 1) whose description is "Printers")
    end tell
end tell

For the above to work in this example the Print Sheet must be visible along with 'Show Details'

The button/drop down has a menu. So you can select or click it by referring to the menu items of the menu of the button.

Either by number or using its title.

activate application "Preview"
    tell application "System Events"
        tell process "Preview"
            click ((pop up buttons of sheet 1 of window 1) whose description is "Presets")

click menu item "Last Used Settings" of menu of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        end tell
    end tell

You can shorten repetitive code by using a variable for the button and calling that. When doing it like my example below;

   activate application "Preview"
tell application "System Events"
    tell process "Preview"
        set Presets_button to item 1 of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        
        click Presets_button
        click menu item "Last Used Settings" of menu of Presets_button
    end tell
end tell

The Buttons (drop downs ) in the Print Sheet have Description to describe the function.

In Accessibility inspector; you see this when hovering the mouse over the element (button). you can lock the Accessibility inspector's view with cmd+F7.

The Description will be listed as AXDescription

enter image description here

In the cases for the Printers its is Printers for Presets it is Presets

If you know the AXDescription you can avoid the numbers using something like this. But this is not the only way. Just one example.

activate application "Preview"
tell application "System Events"
    tell process "Preview"
        click ((pop up buttons of sheet 1 of window 1) whose description is "Printers")
    end tell
end tell

For the above to work in this example the Print Sheet must be visible along with 'Show Details'

The button/drop down has a menu. So you can select or click it by referring to the menu items of the menu of the button.

Either by number or using its title.

activate application "Preview"
    tell application "System Events"
        tell process "Preview"
            click ((pop up buttons of sheet 1 of window 1) whose description is "Presets")

click menu item "Last Used Settings" of menu of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        end tell
    end tell

The Buttons (drop downs ) in the Print Sheet have Description to describe the function.

In Accessibility inspector; you see this when hovering the mouse over the element (button). you can lock the Accessibility inspector's view with cmd+F7.

The Description will be listed as AXDescription

enter image description here

In the cases for the Printers its is Printers for Presets it is Presets

If you know the AXDescription you can avoid the numbers using something like this. But this is not the only way. Just one example.

activate application "Preview"
tell application "System Events"
    tell process "Preview"
        click ((pop up buttons of sheet 1 of window 1) whose description is "Printers")
    end tell
end tell

For the above to work in this example the Print Sheet must be visible along with 'Show Details'

The button/drop down has a menu. So you can select or click it by referring to the menu items of the menu of the button.

Either by number or using its title.

activate application "Preview"
    tell application "System Events"
        tell process "Preview"
            click ((pop up buttons of sheet 1 of window 1) whose description is "Presets")

click menu item "Last Used Settings" of menu of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        end tell
    end tell

You can shorten repetitive code by using a variable for the button and calling that. When doing it like my example below;

   activate application "Preview"
tell application "System Events"
    tell process "Preview"
        set Presets_button to item 1 of ((pop up buttons of sheet 1 of window 1) whose description is "Presets")
        
        click Presets_button
        click menu item "Last Used Settings" of menu of Presets_button
    end tell
end tell
added 547 characters in body
Source Link
markhunte
  • 12.3k
  • 1
  • 34
  • 55
Loading
deleted 118 characters in body
Source Link
markhunte
  • 12.3k
  • 1
  • 34
  • 55
Loading
Source Link
markhunte
  • 12.3k
  • 1
  • 34
  • 55
Loading