I'm trying to write a script that will do one of the following based on hotkey commands using one autohotkey script: a) open a specific (1 out of 10) vnc connection accross a network, b) open 5 (5 out of 10) separate vnc connections accross a network, and c) open all 10 vnc connections accross a network. Each iteration of the script opens a separate connection to the host machine in question. I can get item "c" to work on command, however items (a) and (b) will open more connections than I need, and Im trying to end each hotkey with something like end or exit at the end of its respective script. I have listed the code for items (a) and (b) below as those are the ones that this applies to:
Item (a) and part of Item (b) [for Item (b) this is repeated x times]
^!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
}
For Item (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
}
How can i force the hotkey to end when it finishes a given task, but keeps going given what I have provided?