我只是在学习编写脚本,我想要一个在单个窗口中打开 13 个选项卡的解决方案,为每个窗口运行此命令,每个选项卡的值递增“telnet localhost 2001”...“telnet localhost 2013”,然后命名每个选项卡R1..R1,然后 SW1..SW4,然后 BB1..BB3。
这就是我可以对第一部分和第三部分但不是第二部分的方法。
tell application "Terminal"
activate
tell application "System Events" to keystroke "n" using {command down}
tell application "System Events" to keystroke "t" using {command down}
set custom title of tab 1 of window 1 to "R1"
tell application "System Events" to keystroke "t" using {command down}
set custom title of tab 2 of window 1 to "R2"
tell application "System Events" to keystroke "t" using {command down}
set custom title of tab 3 of window 1 to "R3"
tell application "System Events" to keystroke "t" using {command down}
set custom title of tab 4 of window 1 to "R4"
tell application "System Events" to keystroke "t" using {command down}
set custom title of tab 5 of window 1 to "R5"
tell application "System Events" to keystroke "t" using {command down}
set custom title of tab 6 of window 1 to "R6"
tell application "System Events" to keystroke "t" using {command down}
set custom title of tab 7 of window 1 to "SW1"
tell application "System Events" to keystroke "t" using {command down}
set custom title of tab 8 of window 1 to "SW2"
tell application "System Events" to keystroke "t" using {command down}
set custom title of tab 9 of window 1 to "SW3"
tell application "System Events" to keystroke "t" using {command down}
set custom title of tab 10 of window 1 to "SW4"
tell application "System Events" to keystroke "t" using {command down}
set custom title of tab 11 of window 1 to "BB1"
tell application "System Events" to keystroke "t" using {command down}
set custom title of tab 12 of window 1 to "BB2"
tell application "System Events" to keystroke "t" using {command down}
set custom title of tab 13 of window 1 to "BB3"
end tell
它需要为这些值运行一个子程序,但是在我让它按我想要的方式工作之后我可以处理它。
任何人都可以帮我解决我的问题,因为添加
do script ("telnet localhost 2001")
目前在每个选项卡下打开失败?