Overview
Loop can be controlled via AppleScript using theopen location command, which wraps Loop’s URL scheme. This enables powerful automation and integration with macOS workflows.
AppleScript commands use Loop’s URL scheme under the hood. All URL scheme commands can be executed via AppleScript.
Basic Syntax
AppleScript uses theopen location command to invoke Loop’s URL scheme:
Alternative Syntax
You can also useosascript from the command line:
Activating Loop
To bring Loop to the foreground:Direction Commands
Move or resize windows using directional commands.Basic Directions
Command Line Equivalents
Screen Commands
Move windows between multiple displays.Command Line Equivalents
Action Commands
Execute predefined or custom window actions.Predefined Actions
Custom Actions
Command Line Equivalents
Keybind Commands
Execute custom keybinds by name.Command Line Equivalent
List Commands
Discover available commands, actions, and keybinds.Command Line Equivalents
List commands open a temporary text file with the results, which auto-deletes after 60 seconds.
Advanced AppleScript Examples
Sequential Actions
Chain multiple commands together:Conditional Window Management
Application-Specific Layouts
Multi-Window Layout
Shell Script Integration
Create reusable shell scripts with AppleScript commands.Example: Workspace Setup Script
Example: Quick Window Positions
Keyboard Maestro Integration
Use AppleScript in Keyboard Maestro macros.Example Macro: Window to Left Half
Example Macro: Execute Shell Script
BetterTouchTool Integration
Create custom gestures and shortcuts.Named Trigger
Alfred Integration
Create Alfred workflows for quick window management.Workflow Script
- Type
loop maximizeto maximize window - Type
loop leftto move window left
Automator Integration
Create macOS Services with Automator.Service: Move Window Left
- Open Automator
- Create new “Quick Action”
- Add “Run AppleScript” action:
- Save as “Move Window Left”
- Access from Services menu or keyboard shortcut
Error Handling
Try-Catch Blocks
Checking Application State
Complete Script Examples
Development Workspace Setup
Focus Mode
Screen-Based Layout
Command Reference
Best Practices
See Also
- URL Scheme API - Complete URL command reference
- URL Scheme Guide - URL scheme automation guide
- Custom Actions - Creating custom window actions