09-05-2025, 11:03 PM
Code: (Select All)
While -1
Do
While _MouseInput: Wend
'...some code
Locate 1, 1: Print "Hi, I'm in screen 1. Press 2 then any key for screen 2 or left click to exit."
If InKey$ = "2" Then Cls: Exit Do
If _MouseButton(1) Then Exit While
Loop
Sleep
Do
While _MouseInput: Wend
'....some more code
Locate 1, 1: Print "Hi, I'm in screen 2. Press 1 then any key for screen 1 or left click to exit."
If InKey$ = "1" Then Cls: Exit Do
If _MouseButton(1) Then Exit While
Loop
Sleep
Wend
Keep in mind with this structure you still need to press "any key" after pressing a 1 or 2 to switch screens, but when the prompt is visible, a left mouse click will exit the outer wend loop. Also note that if you press 1 and don't press "any key" the mouse is no longer enabled as coded. You are in a dead zone until "any key" is pressed as SLEEP doesn't poll the mouse.
Pete

