我有以下AppleScript:
if application "iTerm" is running then
tell application "iTerm" to activate
-- repeat with aSession in sessions
tell application "System Events"
keystroke "3" using {command down}
end tell
-- end repeat
end if
在iTerm中,将cmd + 3分配为将配置文件更改为特定配置文件(“将配置文件更改为...”操作)。但是,当我运行脚本时,配置文件不会更改。我可以从AppleScript成功发送其他击键。有趣的是,如果我将cmd + 3重新映射到iTerm中的其他操作,则运行AppleScript可以正常工作,并且其他操作也可以执行。
我知道我可以使用write text "echo -e \"\\033]50;SetProfile=Solarized White\\a\""
更改个人资料,但是如果我有例如emacs在iTerm中打开。