The best way to Automate Opening and Positioning More than one Apps on Mac

by | Sep 26, 2024 | Etcetera | 0 comments

Proper right here’s a simple app I recently created for a chum who needed to incessantly open multiple instances of the equivalent app and position them for easy viewing. While doing this manually isn’t difficult, it is going to perhaps turn out to be tedious when you want to copy the process daily.

App demonstrationApp demonstration

This app automates the obligation, positioning the app exactly the position I would like them to be each time it’s carried out.

Watch the video underneath (sped up 5x) to look exactly how the app works when carried out.

Will have to you’d like to create a similar setup – whether or not or no longer it’s for opening multiple instances of the equivalent app or a mix of more than a few apps – this article will data you throughout the process. I’ll provide the AppleScript used and provide an explanation for customize it to suit your needs, so that you’ll have the ability to open and prepare apps automatically.

Prerequisites/Prerequisites

Proper right here’s the entire thing you’ll want to make this artwork:

The Apps
  • Automator – This built-in macOS app means that you can create custom designed workflows and turn them into executable apps.
  • Magnet – This app lets you prepare open house home windows on your Mac desktop into different positions and sizes using keyboard shortcuts.
  • Code Editor – A code editor is had to edit the AppleScript that it is going to be added to the Automator app later. Will have to you don’t have a code editor installed, the Notes app will artwork too.
AppleScript

Proper right here’s the entire style of the AppleScript I used, which I’ll provide an explanation for in detail later.

tell application "Cricut Design Space" to activate
extend 15 -- Wait 15 seconds for the app to totally liberate

tell application "System Events"
    -- Step 2: Simulate Regulate + Selection + U
    key code 32 using {control down, risk down} -- U key has key code 32
    extend 5 -- Fast extend after keypress

    -- Step 3: Open first new window by means of Document > New Window
    tell process "Cricut Design Space"
        click on on menu products "New Window" of menu "Document" of menu bar 1
    end tell
    extend 5 -- Wait 2 seconds for the new window to open

    -- Step 4: Simulate Regulate + Selection + I
    key code 34 using {control down, risk down} -- I key has key code 34
    extend 5 -- Fast extend after keypress

    -- Step 5: Open second new window by means of Document > New Window
    tell process "Cricut Design Space"
        click on on menu products "New Window" of menu "Document" of menu bar 1
    end tell
    extend 5 -- Wait 2 seconds for the new window to open

    -- Step 6: Simulate Regulate + Selection + J
    key code 38 using {control down, risk down} -- J key has key code 38
    extend 5 -- Fast extend after keypress

    -- Step 7: Open third new window by means of Document > New Window
    tell process "Cricut Design Space"
        click on on menu products "New Window" of menu "Document" of menu bar 1
    end tell
    extend 5 -- Wait 2 seconds for the new window to open

    -- Step 8: Simulate Regulate + Selection + K
    key code 40 using {control down, risk down} -- K key has key code 40
end tell

1. Unlock Automator App

Unlock the Automator app, choose “Device,” and click on on “Choose.”

See also  5 Methods to Generate Qualified Leads in 2022
Automator app interface with Application selectedAutomator app interface with Application selected

Underneath the Actions tab, search for “Run AppleScript,” then choose it and drag it over to the right kind panel.

Automator app showing Run AppleScript action dragged to the panelAutomator app showing Run AppleScript action dragged to the panel

2. Edit AppleScript

Now, in regards to the AppleScript equipped above, you’ll want to edit it to fit your must haves.

Let me spoil down what you need to modify, with explanations along the best way during which. The codes highlighted in bold are the ones you need to edit to fit your must haves.

Step 1
tell application "Cricut Design Space" to activate
extend 15 -- Wait 15 seconds for the app to totally liberate

First, change Cricut Design Space with the determine of the app you need to use.

How do you in finding the suitable determine of your app? Simple. Go to the Systems/ folder, copy the app determine (without the .app extension), and change the one inside the script.

Application folder showing app namesApplication folder showing app names

The extend 15 means the script will wait 15 seconds to allow the app to totally load. You’ll have the ability to reduce this if your app is lighter and slightly a little bit sooner (e.g., Google Chrome, Safari), or increase it for heavier apps (e.g., Adobe Photoshop, Adobe Premiere).

Previously, we’ve urged the script to liberate the app we would really like and added a 15-second extend to ensure it has enough time to totally load previous to executing the rest of the directions.

Next, the remaining actions are marked with step numbers, and so they’re enclosed within:

tell application "System Events"

and

end tell

Proper right here’s a proof of what each step does, together with the parts you need to edit (in bold) to fit your needs.

See also  Obtain 4 FREE Weblog Put up Template Units for Divi

Remember: Talk over with the table at the end of the internet web page for an entire tick list of AppleScript key codes.

Step 2
    -- Step 2: Simulate Regulate + Selection + U
    key code 32 using {control down, risk down} -- U key has key code 32
    extend 2 -- Fast extend after keypress

Simulates the keystroke Regulate + Selection + U, using the Magnet app to place the principle opened app at the top-right corner of the visual display unit.

Step 3
    -- Step 3: Open first new window by means of Document > New Window
    tell process "Cricut Design Space"
        click on on menu products "New Window" of menu "Document" of menu bar 1
    end tell
    extend 2 -- Wait 2 seconds for the new window to open

Simulates clicking on the app’s navigation menu “Document” > “New Window” to open a second copy of the app, then waits 2 seconds for it to load.

Step 4
    -- Step 4: Simulate Regulate + Selection + I
    key code 34 using {control down, risk down} -- I key has key code 34
    extend 2 -- Fast extend after keypress

Simulates the keystroke Regulate + Selection + I to place the second opened app at the top-left of the visual display unit, then waits 2 seconds to ensure the movement is completely carried out.

Step 5
    -- Step 5: Open second new window by means of Document > New Window
    tell process "Cricut Design Space"
        click on on menu products "New Window" of menu "Document" of menu bar 1
    end tell
    extend 2 -- Wait 2 seconds for the new window to open

Simulates clicking on the app’s navigation menu “Document” > “New Window” to open a third copy of the app, then waits 2 seconds for it to load.

Step 6
    -- Step 6: Simulate Regulate + Selection + J
    key code 38 using {control down, risk down} -- J key has key code 38
    extend 5 -- Fast extend after keypress

Simulates the keystroke Regulate + Selection + J to place the third opened app at the bottom-left of the visual display unit, then waits 5 seconds for the movement to be completely carried out.

Step 7
    -- Step 7: Open third new window by means of Document > New Window
    tell process "Cricut Design Space"
        click on on menu products "New Window" of menu "Document" of menu bar 1
    end tell
    extend 2 -- Wait 2 seconds for the new window to open

Simulates clicking on the app’s navigation menu “Document” > “New Window” to open a fourth and supreme copy of the app, then waits 2 seconds for it to load.

See also  Recent Assets for Internet Designers and Builders (September 2024)
Step 8
    -- Step 8: Simulate Regulate + Selection + K
    key code 40 using {control down, risk down} -- K key has key code 40

Simulates the keystroke Regulate + Selection + K to place the fourth opened app at the bottom-right of the visual display unit.

3. Replace Script, Check out Script

Along side your edited style of the script, paste it inside the “Run AppleScript” movement, converting the existing one. Click on at the Run button immediately on top or the Run button inside the top-right corner of the visual display unit to test if it actually works. If it doesn’t, debug the script and take a look at it another time.

Running AppleScript within Automator to test the scriptRunning AppleScript within Automator to test the script

As quickly because it runs successfully as expected, pass to the best possible menu bar and click on on Document > Save. Make sure that the Document Structure is able to “Device” so it’s saved as an executable program.

4. Edit Privacy & Protection Settings

Given that app performs automated keystrokes on your Mac, macOS will block it by the use of default. To ensure it actually works correctly, you’ll want to grant the app the vital permissions.

Open System Settings and navigate to Privacy & Protection > Accessibility. Permit the app, or click on at the “+” button at the bottom so that you can upload it if it’s not already listed.

macOS Privacy and Security settings showing Accessibility optionsmacOS Privacy and Security settings showing Accessibility options

AppleScript Key Code Reference

Key Key Code Key Key Code
A 0 B 11
C 8 D 2
E 14 F 3
G 5 H 4
I 34 J 38
K 40 L 37
M 46 N 45
O 31 P 35
Q 12 R 15
S 1 T 17
U 32 V 9
W 13 X 7
Y 16 Z 6
1 18 2 19
3 20 4 21
5 23 6 22
7 26 8 28
9 25 0 29
Identical (=) 24 Minus (-) 27
Correct Bracket (]) 30 Left Bracket ([) 33
Quote (‘) 39 Semicolon (;) 41
Comma (,) 43 Duration (.) 47
Slash (/) 44 Backslash () 42
Tab 48 House 49
Go back (Input) 36 Get away (Esc) 53
Delete 51 Ahead Delete 117
House 115 Finish 119
Web page Up 116 Web page Down 121
Left Arrow 123 Proper Arrow 124
Down Arrow 125 Up Arrow 126

The publish The best way to Automate Opening and Positioning More than one Apps on Mac gave the impression first on Hongkiat.

WordPress Website Development

Source: https://www.hongkiat.com/blog/automate-app-opening-positioning-mac/

[ continue ]

WordPress Maintenance Plans | WordPress Hosting

read more

0 Comments

Submit a Comment

DON'T LET YOUR WEBSITE GET DESTROYED BY HACKERS!

Get your FREE copy of our Cyber Security for WordPress® whitepaper.

You'll also get exclusive access to discounts that are only found at the bottom of our WP CyberSec whitepaper.

You have Successfully Subscribed!