在具有标题的应用程序中激活 window
Activate a window in an application with a title
试图弄清楚如何在 iTerm 中使用特定的 name/title 和 applescript 激活 window。我最近的努力:
#!/usr/bin/osascript
tell application "iTerm2"
set winlist to every window
repeat with win in winlist
set the_title to title of window win
if the_title contains "Development" then
activate win
end if
end repeat
end tell
但是我收到这个错误:
execution error: iTerm got an error: Can’t make title of window (window id 203) into type specifier. (-1700)
window 处于全屏模式,所以我不确定这是否有影响。
以下示例 AppleScript code 在 macOS 下对我有效High Sierra,在脚本编辑器中,切换到包含目标的全屏window ]姓名:
tell application "iTerm"
set winlist to every window
repeat with win in winlist
set the_title to name of win
if the_title contains "Development" then
activate
set index of win to 1
end if
end repeat
end tell
如果目标window不在全屏中,只是将其提升到最前面。
试图弄清楚如何在 iTerm 中使用特定的 name/title 和 applescript 激活 window。我最近的努力:
#!/usr/bin/osascript
tell application "iTerm2"
set winlist to every window
repeat with win in winlist
set the_title to title of window win
if the_title contains "Development" then
activate win
end if
end repeat
end tell
但是我收到这个错误:
execution error: iTerm got an error: Can’t make title of window (window id 203) into type specifier. (-1700)
window 处于全屏模式,所以我不确定这是否有影响。
以下示例 AppleScript code 在 macOS 下对我有效High Sierra,在脚本编辑器中,切换到包含目标的全屏window ]姓名:
tell application "iTerm"
set winlist to every window
repeat with win in winlist
set the_title to name of win
if the_title contains "Development" then
activate
set index of win to 1
end if
end repeat
end tell
如果目标window不在全屏中,只是将其提升到最前面。