Skip to main content

Overview

Loop can be controlled via AppleScript using the open 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 the open location command to invoke Loop’s URL scheme:

Alternative Syntax

You can also use osascript from the command line:

Activating Loop

To bring Loop to the foreground:
From Terminal:

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

Usage:

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

Usage in Alfred:
  • Type loop maximize to maximize window
  • Type loop left to move window left

Automator Integration

Create macOS Services with Automator.

Service: Move Window Left

  1. Open Automator
  2. Create new “Quick Action”
  3. Add “Run AppleScript” action:
  1. Save as “Move Window Left”
  2. 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

Add delays between commands when chaining multiple actions to allow windows to finish positioning before the next command executes.
Check application state before executing commands to ensure Loop is running.
Use try-catch blocks for robust error handling in production scripts.
Commands operate on the frontmost window. Ensure proper window activation and timing when scripting multi-window layouts.

See Also