gpt4 book ai didi

windows - 自动热键脚本中的多个热键命令

转载 作者:可可西里 更新时间:2023-11-01 10:06:55 24 4
gpt4 key购买 nike

我正在尝试编写一个脚本,该脚本将使用一个自动热键脚本根据热键命令执行以下操作之一:a) 打开一个特定的(10 个中的 1 个)跨网络的 vnc 连接,b) 打开 5 (5在 10 个中)跨网络的单独 vnc 连接,以及 c)打开跨网络的所有 10 个 vnc 连接。脚本的每次迭代都会打开一个与相关主机的单独连接。我可以让项目“c”在命令上工作,但是项目 (a) 和 (b) 将打开比我需要的更多的连接,并且我试图在每个热键结束时在其各自脚本的末尾使用 end 或 exit 之类的东西来结束。我在下面列出了项目 (a) 和 (b) 的代码,因为它们适用于:

项目 (a) 和项目 (b) 的一部分 [对于项目 (b) 重复 x 次]

^!c::
{
Run, vnc-E4_6_3-x86_win32_viewer.exe, C:\Program Files (x86)\RealVNC\VNC4 Viewer
WinWaitActive, VNC Viewer
{
Send Frankenstien-SubSystem-1
Send {enter}
}
WinWaitActive, Authentication Credentials
{
Send {Shift Down}
Send {Tab}
Send {Shift Up}
Send <username>
Send {Tab}
Send <password>
Send {enter}
}
Sleep 2000 [Only used for items (b) and (c) ;<== End here for Item (a) only
}

对于项目(b)

#a::
{
Run, vnc-E4_6_3-x86_win32_viewer.exe, C:\Program Files (x86)\RealVNC\VNC4 Viewer
WinWaitActive, VNC Viewer
{
Send Frankenstien-SubSystem-1
Send {enter}
}
WinWaitActive, Authentication Credentials
{
Send {Shift Down}
Send {Tab}
Send {Shift Up}
Send <username>
Send {Tab}
Send <password>
Send {enter}
}
Sleep 2000 [Only used for items (b) and (c)
Run, vnc-E4_6_3-x86_win32_viewer.exe, C:\Program Files (x86)\RealVNC\VNC4 Viewer
WinWaitActive, VNC Viewer
{
Send Frankenstien-SubSystem-2
Send {enter}
}
WinWaitActive, Authentication Credentials
{
Send {Shift Down}
Send {Tab}
Send {Shift Up}
Send <username>
Send {Tab}
Send <password>
Send {enter}
}
Sleep 2000 [Only used for items (b) and (c)
Run, vnc-E4_6_3-x86_win32_viewer.exe, C:\Program Files (x86)\RealVNC\VNC4 Viewer
WinWaitActive, VNC Viewer
{
Send Frankenstien-SubSystem-3
Send {enter}
}
WinWaitActive, Authentication Credentials
{
Send {Shift Down}
Send {Tab}
Send {Shift Up}
Send <username>
Send {Tab}
Send <password>
Send {enter}
}
Sleep 2000 [Only used for items (b) and (c)
Run, vnc-E4_6_3-x86_win32_viewer.exe, C:\Program Files (x86)\RealVNC\VNC4 Viewer
WinWaitActive, VNC Viewer
{
Send Frankenstien-SubSystem-4
Send {enter}
}
WinWaitActive, Authentication Credentials
{
Send {Shift Down}
Send {Tab}
Send {Shift Up}
Send <username>
Send {Tab}
Send <password>
Send {enter}
}
Sleep 2000 [Only used for items (b) and (c)
Run, vnc-E4_6_3-x86_win32_viewer.exe, C:\Program Files (x86)\RealVNC\VNC4 Viewer
WinWaitActive, VNC Viewer
{
Send Frankenstien-SubSystem-5
Send {enter}
}
WinWaitActive, Authentication Credentials
{
Send {Shift Down}
Send {Tab}
Send {Shift Up}
Send <username>
Send {Tab}
Send <password>
Send {enter}
}
;END Here; <== Item (b) twice
}

我如何在完成给定任务时强制热键结束,但根据我提供的内容继续运行?

最佳答案

您正在寻找 Return 命令来停止执行您的热键。请参阅下面的代码片段。我创建了一个函数,您可以使用它来调用特定机器而无需重复太多代码。通过这种方式,您将获得所需的特定机器。

#a::VNC("Frankenstien-SubSystem-1", "myuser", "mypass")

#b::
VNC("Frankenstien-SubSystem-1", "myuser", "mypass")
VNC("Frankenstien-SubSystem-2", "myuser", "mypass")
VNC("Frankenstien-SubSystem-3", "myuser", "mypass")
VNC("Frankenstien-SubSystem-4", "myuser", "mypass")
VNC("Frankenstien-SubSystem-5", "myuser", "mypass")
Return

#c::
VNC("Frankenstien-SubSystem-1", "myuser", "mypass")
VNC("Frankenstien-SubSystem-2", "myuser", "mypass")
VNC("Frankenstien-SubSystem-3", "myuser", "mypass")
VNC("Frankenstien-SubSystem-4", "myuser", "mypass")
VNC("Frankenstien-SubSystem-5", "myuser", "mypass")
; ... and so on
Return


VNC(machine, user, pw)
{
Run, vnc-E4_6_3-x86_win32_viewer.exe, C:\Program Files (x86)\RealVNC\VNC4 Viewer
WinWaitActive, VNC Viewer
{
Send % machine
Send {enter}
}
WinWaitActive, Authentication Credentials
{
Send {Shift Down}
Send {Tab}
Send {Shift Up}
Send % user
Send {Tab}
Send % pw
Send {enter}
}
Sleep 2000
}
}

关于windows - 自动热键脚本中的多个热键命令,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17032897/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com