Skip to content

Instantly share code, notes, and snippets.

@dnicolson
Created March 3, 2024 21:36
Show Gist options
  • Save dnicolson/42a8342b93fba49cbf1d69c82daeb7f0 to your computer and use it in GitHub Desktop.
Save dnicolson/42a8342b93fba49cbf1d69c82daeb7f0 to your computer and use it in GitHub Desktop.
Perform "Fix All Issues" for an array of files in Xcode
#!/usr/bin/env osascript -l JavaScript
var filePaths = [];
function fixFile(filePath) {
console.log(filePath);
var xcode = Application('Xcode');
xcode.activate();
xcode.open(filePath);
var systemEvents = Application('System Events');
var xcodeProcess = systemEvents.processes.byName('Xcode');
xcodeProcess.menuBars[0].menuBarItems.byName('Editor').menus[0].menuItems.byName('Fix All Issues').click();
// systemEvents.keystroke('w', { using: 'command down' });
}
filePaths.forEach(fixFile);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment