Loop can be controlled using AppleScript, allowing you to integrate window management into your macOS automation workflows.
Basic AppleScript Commands
Activating Loop
Bring Loop to the foreground:
tell application "Loop" to activate
Shell execution:
osascript -e 'tell application "Loop" to activate'
URL Scheme Integration
Execute Loop commands using the URL scheme:
open location "loop://direction/left"
Shell execution:
osascript -e 'open location "loop://direction/left"'
Common Use Cases
Window Positioning
Move windows to specific positions:
# Move window to right half
osascript -e 'open location "loop://direction/right"'
# Move window to left half
osascript -e 'open location "loop://direction/left"'
# Maximize window
osascript -e 'open location "loop://action/maximize"'
Screen Management
Move windows between displays:
# Move to next screen
osascript -e 'open location "loop://screen/next"'
# Move to previous screen
osascript -e 'open location "loop://screen/previous"'
Keyboard Maestro
Create a Keyboard Maestro macro that executes AppleScript:
- Create a new macro
- Add “Execute AppleScript” action
- Use the AppleScript command:
open location "loop://direction/right"
Alfred Workflows
Create an Alfred workflow that runs AppleScript:
- Create a new workflow
- Add a “Run Script” action
- Set language to “AppleScript”
- Add your Loop commands
Automator
Create Automator workflows with Loop commands:
- Create a new Automator workflow
- Add “Run AppleScript” action
- Include Loop URL scheme commands
Shell Scripts
Combine AppleScript with shell scripts for more complex automation:
#!/bin/bash
# Activate Loop
osascript -e 'tell application "Loop" to activate'
# Execute window command
osascript -e 'open location "loop://direction/right"'
Tips
All Loop URL scheme commands can be executed through AppleScript using the open location syntax.
For quick one-off commands, use osascript -e directly from the terminal.
Chain multiple commands together in a single AppleScript or shell script for complex workflows.
Next Steps
URL Scheme Reference
Complete URL command reference
Scripting Examples
Real-world automation examples