Last active
January 14, 2024 06:46
-
-
Save kfix/6dd55721766ff9fae0dd to your computer and use it in GitHub Desktop.
debugging iterm JS applescript window indexing failures
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/osascript -l JavaScript | |
var iTerm = Application("iTerm"); | |
iTerm.includeStandardAdditions = true; | |
iTerm.activate() | |
var new_win = function() { | |
var myNewWindow = iTerm.createWindowWithDefaultProfile({command: "/bin/bash"}); | |
// https://github.com/gnachman/iTerm2/search?q=iTermNewWindowCommand | |
console.log("New window created: " + Automation.getDisplayString(myNewWindow, true)); | |
return myNewWindow; | |
} | |
function run(argv) { | |
console.log(Automation.getDisplayString(iTerm.windows(), true)); | |
var win = new_win(); | |
console.log(Automation.getDisplayString(iTerm.windows(), true)); | |
//console.log(iTerm.windows.whose({name: {_contains: 'bash'}})().length); | |
console.log(win.index()); | |
} | |
// https://gitlab.com/gnachman/iterm2/issues/3910 | |
// defaults write NSGlobalDomain NSScriptingDebugLogLevel 1 | |
// syslog -w 0 -k Facility com.googlecode.iterm2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment