Advertise Here

The best way to automate opening and placing multiple apps on Mac

by | Sep 26, 2024 | Etcetera, wordpress maintenance, wordpress seo | 0 comments


That’s right, here’s a simple app I recently created for a friend who wanted to continuously open multiple instances of the same app and position them for easy viewing. While doing it manually is not difficult, it might prove tedious if you want to copy the process on a daily basis.

Demonstration of the app

This app automates the obligation, placing the app exactly where I would like it to be every time it runs.

Check out the video below (speeded up 5 times) to see exactly how the app works once run.

If you want to create a similar setup, whether or not it serves to open multiple instances of the equivalent app or a mix of more than a few apps, this article will inform you throughout the process. I will provide the AppleScript used and give an explanation to customize it to your needs, so that you have the ability to open and prepare apps automatically.

Prerequisites/Prerequisites

That’s right, here’s everything you’ll need to make this work of art:

The apps
  • Automation – This built-in macOS app lets you create custom workflows and turn them into executable apps.
  • Magnet – This app allows you to set open windows on your Mac desktop in different positions and sizes using keyboard shortcuts.
  • Code editor – A code editor is required to edit the AppleScript that will later be added to the Automator app. You will need to not have a code editor installed, the Notes app will also have graphics.
AppleScript

That’s right, here’s the entire AppleScript style I used, which I’ll give a detailed explanation of 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 the Automator app

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

Automator app interface with the selected applicationAutomator app interface with the selected application

On the Actions tab, search for “Run AppleScript”, then select it and drag it to the right panel.

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

2. Edit AppleScript

Now, regarding the AppleScript provided above, we recommend that you modify it to suit your must-haves.

Let me spoil what you need to change, with explanations on how to do it. THE the codes highlighted in bold are the ones you need to change 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 determining which app you need to use.

How do you find the right definition for your app? Simple. Go to Systems/ folder, copy the app file (without the .app extension) and change that within the script.

Application folder showing app namesApplication folder showing app names

THE extend 15 it means the script will wait 15 seconds to allow the app to fully load. You will have the option to reduce it if your app is lighter and slightly faster (e.g. Google Chrome, Safari) or increase it for heavier apps (e.g. Adobe Photoshop, Adobe Premiere).

Previously, we urged the script to free the app we really liked, and added a 15-second extension to ensure it has enough time to fully load before executing the rest of the instructions.

Next, the remaining actions are marked with step numbers and then are enclosed within:

tell application "System Events"

AND

end tell

Right here is a proof of what each step does, along with the parts you need to change (in bold) to meet your needs.

Remember: See the table at the end of the Internet web page for an entire 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

Simulate the keystroke Regular + Selection + Uusing App Magnet to place the main open app in the top right corner of the display.

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 the app navigation menu “Document” > “New Window” to open a second copy of the app, then waits 2 seconds to load it.

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

Simulate the keystroke Regular + Selection + I to place the second open app at the top left of the display, then wait 2 seconds to ensure that the movement is performed completely.

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 the app navigation menu “Document” > “New Window” to open a third copy of the app, then waits 2 seconds to load it.

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

Simulate the keystroke Regular + Selection + J to place the third open app at the bottom left of the display, then wait 5 seconds for the movement to be performed completely.

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 the app navigation menu “Document” > “New Window” to open a fourth and supreme copy of the app, then waits 2 seconds to load it.

Step 8

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

Simulate the keystroke Regular + Selection + K to position the fourth open app at the bottom right of the display.

3. Replace script, check script

Next to the modified script style, paste it inside the ” fieldRun AppleScript” movement, converting the existing one. Click in Run button immediately at the top or the Run button in the top right corner of the display to check if it actually works. If not, debug the script and take a look at it another time.

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

As soon as it works fine as expected, go to the best possible menu bar and click Document > Save. Make sure the document structure is capable of “Device” then it is saved as an executable program.

4. Change your privacy and security settings

Since the app performs automated keystrokes on your Mac, macOS will block it by default. To ensure that it actually works properly, we recommend that you grant the app vital permissions.

Open System Settings and go to Privacy and protection > Accessibility. Allow the app or click “+” below so you can upload it if it’s not already listed.

security-accessibility.jpg” alt=”macOS privacy and security settings showing accessibility options”/>macOS privacy and <a href=security settings showing accessibility options” data-lazy-src=”https://wpmountain.com/wp-content/uploads/2024/09/privacy-security-accessibility.jpg”/>

AppleScript Key Code Reference

Key Key code Key Key code
A 0 B 11
C 8 D 2
AND 14 F 3
G 5 H 4
I 34 J 38
K 40 the 37
M 46 No 45
OR 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 Less (-) 27
Correct parenthesis (]) 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



Source link

thatguy
Author: thatguy

Places

Services

  • No Categories

Classifieds

  • No Categories

Events

News

Shopping