BoonPek Posted February 18, 2010 Share Posted February 18, 2010 This is a program I made which asks 'Do you think that you are good with Computers?' where you click Yes or No, but It doesn't allow Yes to be selected. expandcollapse popup;Programmed by: Boon Pek ;To enable the TAB button, Press Ctrl + Alt + Shift + ESC ;Program Based on Mr. Carter's program on Visual Basic ;Impossible to Click "Yes" without knowing the combinations #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> Opt('MustDeclareVars', 1) Local $Tab = 1 HotKeySet("{TAB}", "_DoNothing") HotKeySet("{LEFT}", "_DoNothing") HotKeySet("{RIGHT}", "_DoNothing") HotKeySet('!+^{ESC}', "_Unlock") If WinExists("Computer Science - Question", "") Then Exit EndIf _Main() Func _DoNothing() EndFunc ;==>_DoNothing Func _Unlock() HotKeySet("{TAB}") HotKeySet("{LEFT}") HotKeySet("{RIGHT}") EndFunc ;==>_Unlock Func _Main() Local $YesID, $NoID, $msg, $Info, $Active, $State = 1 GUICreate("Computer Science - Question", 350, 120, -1, -1, $WS_SYSMENU) GUICtrlCreateLabel("Do you think that you are good with Computers?", 10, 10, 330) GUICtrlSetFont(-1, 11, 400, "", "Tahoma") $YesID = GUICtrlCreateButton("Yes, I am!", 60, 50, 100, 25) $NoID = GUICtrlCreateButton("No, I am not!", 185, 50, 100, 25) GUISetState() Do If WinActive("Computer Science - Question", "") Then $Info = GUIGetCursorInfo() $msg = GUIGetMsg() Select Case $msg = $YesID If $State = 1 Then MsgBox(64, "Computer Science - Question", "Congratulations!" & @CRLF & @CRLF & "Yes, you are good with Computers!", 0) Exit Else GUICtrlSetState($YesID, $GUI_DISABLE) GUICtrlSetState($NoID, $GUI_DISABLE) MsgBox(48, "Computer Science - Question", "Sorry, Please try again!" & @CRLF & @CRLF & "No, You are not good with Computers!", 0) GUICtrlSetState($YesID, $GUI_ENABLE) GUICtrlSetState($NoID, $GUI_ENABLE) EndIf Case $msg = $NoID If $State = 0 Then MsgBox(64, "Computer Science - Question", "Congratulations!" & @CRLF & @CRLF & "Yes, you are good with Computers!", 0) Exit Else GUICtrlSetState($YesID, $GUI_DISABLE) GUICtrlSetState($NoID, $GUI_DISABLE) MsgBox(48, "Computer Science - Question", "Sorry, Please try again!" & @CRLF & @CRLF & "No, You are not good with Computers!", 0) GUICtrlSetState($YesID, $GUI_ENABLE) GUICtrlSetState($NoID, $GUI_ENABLE) EndIf EndSelect If $Info[4] = 5 Then If $Active = 1 Then If $State = 1 Then GUICtrlSetData($YesID, "No, I am not!") GUICtrlSetData($NoID, "Yes, I am!") $State = 0 Else GUICtrlSetData($YesID, "Yes, I am!") GUICtrlSetData($NoID, "No, I am not!") $State = 1 EndIf $Active = 0 EndIf EndIf If $Info[4] = 4 Then If $Active = 0 Then If $State = 1 Then GUICtrlSetData($YesID, "No, I am not!") GUICtrlSetData($NoID, "Yes, I am!") $State = 0 Else GUICtrlSetData($YesID, "Yes, I am!") GUICtrlSetData($NoID, "No, I am not!") $State = 1 EndIf $Active = 1 EndIf EndIf EndIf Until $msg = $GUI_EVENT_CLOSE EndFunc ;==>_Main Everything here is messy, and there are things which take up unnecessary space. You can help to try and optimise the code if you want to. Link to comment Share on other sites More sharing options...
ProgAndy Posted February 18, 2010 Share Posted February 18, 2010 (edited) Got it (without Hotkey) Mouse down on NO move away from button Mouse up Mouse over Yes-Button ENTER Edit: Or use AutoIt with ControlClick. Edited February 18, 2010 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
FinalVersion Posted February 18, 2010 Share Posted February 18, 2010 Control Tab => Tab Prevention. [center][+] Steam GUI [+][+] Clipboard Tool [+][+] System :: Uptime [+][+] StarCraft II Mouse Trap [+][/center] Link to comment Share on other sites More sharing options...
lordicast Posted February 18, 2010 Share Posted February 18, 2010 (edited) Uh Click gui, press down,press up, press enter, Done Edited February 18, 2010 by lordicast [Cheeky]Comment[/Cheeky] Link to comment Share on other sites More sharing options...
lordicast Posted February 18, 2010 Share Posted February 18, 2010 Slighty harder expandcollapse popup;Programmed by: Boon Pek ;To enable the TAB button, Press Ctrl + Alt + Shift + ESC ;Program Based on Mr. Carter's program on Visual Basic ;Impossible to Click "Yes" without knowing the combinations #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> Opt('MustDeclareVars', 1) Local $Tab = 1 HotKeySet("{TAB}", "_DoNothing") HotKeySet("{LEFT}", "_DoNothing") HotKeySet("{RIGHT}", "_DoNothing") HotKeySet("{Up}", "_DoNothing") HotKeySet("{Down}", "_DoNothing") HotKeySet("{enter}", "_DoNothing") HotKeySet('!+^{ESC}', "_Unlock") If WinExists("Computer Science - Question", "") Then Exit EndIf _Main() Func _DoNothing() EndFunc ;==>_DoNothing Func _Unlock() HotKeySet("{TAB}") HotKeySet("{LEFT}") HotKeySet("{RIGHT}") EndFunc ;==>_Unlock Func _Main() Local $YesID, $NoID, $msg, $Info, $Active, $State = 1 GUICreate("Computer Science - Question", 350, 120, -1, -1, $WS_SYSMENU) GUICtrlCreateLabel("Do you think that you are good with Computers?", 10, 10, 330) GUICtrlSetFont(-1, 11, 400, "", "Tahoma") $YesID = GUICtrlCreateButton("Yes, I am!", 60, 50, 100, 25) $NoID = GUICtrlCreateButton("No, I am not!", 185, 50, 100, 25) GUISetState() Do If WinActive("Computer Science - Question", "") Then $Info = GUIGetCursorInfo() $msg = GUIGetMsg() Select Case $msg = $YesID If $State = 1 Then MsgBox(64, "Computer Science - Question", "Congratulations!" & @CRLF & @CRLF & "Yes, you are good with Computers!", 0) Exit Else GUICtrlSetState($YesID, $GUI_DISABLE) GUICtrlSetState($NoID, $GUI_DISABLE) MsgBox(48, "Computer Science - Question", "Sorry, Please try again!" & @CRLF & @CRLF & "No, You are not good with Computers!", 0) GUICtrlSetState($YesID, $GUI_ENABLE) GUICtrlSetState($NoID, $GUI_ENABLE) EndIf Case $msg = $NoID If $State = 0 Then MsgBox(64, "Computer Science - Question", "Congratulations!" & @CRLF & @CRLF & "Yes, you are good with Computers!", 0) Exit Else GUICtrlSetState($YesID, $GUI_DISABLE) GUICtrlSetState($NoID, $GUI_DISABLE) MsgBox(48, "Computer Science - Question", "Sorry, Please try again!" & @CRLF & @CRLF & "No, You are not good with Computers!", 0) GUICtrlSetState($YesID, $GUI_ENABLE) GUICtrlSetState($NoID, $GUI_ENABLE) EndIf EndSelect If $Info[4] = 5 Then If $Active = 1 Then If $State = 1 Then GUICtrlSetData($YesID, "No, I am not!") GUICtrlSetData($NoID, "Yes, I am!") $State = 0 Else GUICtrlSetData($YesID, "Yes, I am!") GUICtrlSetData($NoID, "No, I am not!") $State = 1 EndIf $Active = 0 EndIf EndIf If $Info[4] = 4 Then If $Active = 0 Then If $State = 1 Then GUICtrlSetData($YesID, "No, I am not!") GUICtrlSetData($NoID, "Yes, I am!") $State = 0 Else GUICtrlSetData($YesID, "Yes, I am!") GUICtrlSetData($NoID, "No, I am not!") $State = 1 EndIf $Active = 1 EndIf EndIf EndIf Until $msg = $GUI_EVENT_CLOSE EndFunc ;==>_Main [Cheeky]Comment[/Cheeky] Link to comment Share on other sites More sharing options...
ProgAndy Posted February 18, 2010 Share Posted February 18, 2010 (edited) [Ctrl]-[Tab] + [space] lets you win! Edited February 18, 2010 by ProgAndy *GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes Link to comment Share on other sites More sharing options...
jvanegmond Posted February 18, 2010 Share Posted February 18, 2010 It may be me, but when I start the application and press SPACE I have won. github.com/jvanegmond Link to comment Share on other sites More sharing options...
BoonPek Posted February 19, 2010 Author Share Posted February 19, 2010 Here... Made it a little better, so that if the Window is not active, the keys will not be disabled. expandcollapse popup;Programmed by: Boon Pek ;To enable the TAB button, Press Ctrl + Alt + Shift + ESC ;Program Based on Mr. Carter's program on Visual Basic ;Impossible to Click "Yes" without knowing the combinations #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Misc.au3> Opt('MustDeclareVars', 1) Local $Tab = 1, $Lock = 1 HotKeySet('!+^{ESC}', "_Unlock") If WinExists("Computer Science - Question", "") Then Exit EndIf _Main() Func _DoNothing() EndFunc ;==>_DoNothing Func _Unlock() $Lock = 0 EndFunc ;==>_Unlock Func _Main() Local $YesID, $NoID, $msg, $Info, $Active, $State = 1 GUICreate("Computer Science - Question", 350, 120, -1, -1, $WS_SYSMENU) GUICtrlCreateLabel("Do you think that you are good with Computers?", 10, 10, 330) GUICtrlSetFont(-1, 11, 400, "", "Tahoma") $YesID = GUICtrlCreateButton("Yes, I am!", 60, 50, 100, 25) $NoID = GUICtrlCreateButton("No, I am not!", 185, 50, 100, 25) GUISetState() Do If WinActive("Computer Science - Question", "") Then $Info = GUIGetCursorInfo() $msg = GUIGetMsg() Select Case $msg = $YesID If $State = 1 Then MsgBox(64, "Computer Science - Question", "Congratulations!" & @CRLF & @CRLF & "Yes, you are good with Computers!", 0) Exit Else GUICtrlSetState($YesID, $GUI_DISABLE) GUICtrlSetState($NoID, $GUI_DISABLE) MsgBox(48, "Computer Science - Question", "Sorry, Please try again!" & @CRLF & @CRLF & "No, You are not good with Computers!", 0) GUICtrlSetState($YesID, $GUI_ENABLE) GUICtrlSetState($NoID, $GUI_ENABLE) EndIf Case $msg = $NoID If $State = 0 Then MsgBox(64, "Computer Science - Question", "Congratulations!" & @CRLF & @CRLF & "Yes, you are good with Computers!", 0) Exit Else GUICtrlSetState($YesID, $GUI_DISABLE) GUICtrlSetState($NoID, $GUI_DISABLE) MsgBox(48, "Computer Science - Question", "Sorry, Please try again!" & @CRLF & @CRLF & "No, You are not good with Computers!", 0) GUICtrlSetState($YesID, $GUI_ENABLE) GUICtrlSetState($NoID, $GUI_ENABLE) EndIf EndSelect If $Info[4] = 5 Then If $Active = 1 Then If $State = 1 Then GUICtrlSetData($YesID, "No, I am not!") GUICtrlSetData($NoID, "Yes, I am!") $State = 0 Else GUICtrlSetData($YesID, "Yes, I am!") GUICtrlSetData($NoID, "No, I am not!") $State = 1 EndIf $Active = 0 EndIf EndIf If $Info[4] = 4 Then If $Active = 0 Then If $State = 1 Then GUICtrlSetData($YesID, "No, I am not!") GUICtrlSetData($NoID, "Yes, I am!") $State = 0 Else GUICtrlSetData($YesID, "Yes, I am!") GUICtrlSetData($NoID, "No, I am not!") $State = 1 EndIf $Active = 1 EndIf EndIf If $Lock = 1 Then HotKeySet("{TAB}", "_DoNothing") HotKeySet("{LEFT}", "_DoNothing") HotKeySet("{RIGHT}", "_DoNothing") HotKeySet("{UP}", "_DoNothing") HotKeySet("{DOWN}", "_DoNothing") HotKeySet("{SPACE}", "_DoNothing") HotKeySet("{ENTER}", "_DoNothing") Else HotKeySet("{TAB}") HotKeySet("{LEFT}") HotKeySet("{RIGHT}") HotKeySet("{UP}") HotKeySet("{DOWN}") HotKeySet("{SPACE}") HotKeySet("{ENTER}") EndIf Else HotKeySet("{TAB}") HotKeySet("{LEFT}") HotKeySet("{RIGHT}") HotKeySet("{UP}") HotKeySet("{DOWN}") HotKeySet("{SPACE}") HotKeySet("{ENTER}") EndIf Until $msg = $GUI_EVENT_CLOSE EndFunc ;==>_Main Link to comment Share on other sites More sharing options...
notsure Posted February 19, 2010 Share Posted February 19, 2010 Shift + TAB CTRL + Enter == win. Link to comment Share on other sites More sharing options...
logmein Posted February 19, 2010 Share Posted February 19, 2010 Shift + Space = Win! [font=arial, helvetica, sans-serif][s]Total USB Security 3.0 Beta[/s] | [s]Malware Kill[/s] | Malware Scanner | Screen Hider | Locker | Matrix Generator[s]AUTO-SYNC 1.0 | MD5 Hash Generator | URL Checker | Tube Take [/s]| Random Text[/font] Link to comment Share on other sites More sharing options...
Asaman83687 Posted February 19, 2010 Share Posted February 19, 2010 Click and Hold the yes button. then move the mouse to the other button (without letting go) , finally press Enter Link to comment Share on other sites More sharing options...
BoonPek Posted February 19, 2010 Author Share Posted February 19, 2010 This is as far as I can get into making it more compact expandcollapse popup;Programmed by: Boon Pek ;To enable the TAB button, Press Ctrl + Alt + Shift + ESC ;Program Based on Mr. Carter's program on Visual Basic ;Impossible to Click "Yes" without knowing the combinations Opt('MustDeclareVars', 1) Global $Lock = 1, $State = 1, $Active = 1 Global $Title = "Computer Science - Question", $Yes = "Yes, I am!", $No = "No, I am not!" Global $YesID, $NoID, $msg, $Info HotKeySet('!+^{ESC}', "_Unlock") If WinExists($Title, "") Then Exit EndIf _MainGui() Func _Nothing() EndFunc ;==>_Nothing Func _Unlock() $Lock = 0 EndFunc ;==>_Unlock Func _Disable() HotKeySet("{TAB}") HotKeySet("{LEFT}") HotKeySet("{RIGHT}") HotKeySet("{UP}") HotKeySet("{DOWN}") HotKeySet("{SPACE}") HotKeySet("{ENTER}") EndFunc ;==>_Disable Func _Enable() HotKeySet("{TAB}", "_Nothing") HotKeySet("{LEFT}", "_Nothing") HotKeySet("{RIGHT}", "_Nothing") HotKeySet("{UP}", "_Nothing") HotKeySet("{DOWN}", "_Nothing") HotKeySet("{SPACE}", "_Nothing") HotKeySet("{ENTER}", "_Nothing") EndFunc ;==>_Enable Func _Message($Status) _Disable() GUICtrlSetState($YesID, 128) GUICtrlSetState($NoID, 128) If $Status = 0 Then MsgBox(48, $Title, "Sorry, Please try again!" & @CRLF & @CRLF & "No, You are not good with Computers!", 0) Else MsgBox(64, $Title, "Congratulations!" & @CRLF & @CRLF & "Yes, you are good with Computers!", 0) Exit EndIf GUICtrlSetState($YesID, 64) GUICtrlSetState($NoID, 64) _Enable() EndFunc ;==>_Message Func _Button() If $State = 1 Then GUICtrlSetData($YesID, $No) GUICtrlSetData($NoID, $Yes) $State = 0 Else GUICtrlSetData($YesID, $Yes) GUICtrlSetData($NoID, $No) $State = 1 EndIf EndFunc ;==>_Button Func _MainGui() GUICreate($Title, 340, 120, -1, -1, 0x00080000) GUICtrlCreateLabel("Do you think you are good with Computers?", 10, 10, 320) GUICtrlSetFont(-1, 11, 800, "", "Tahoma") $YesID = GUICtrlCreateButton($Yes, 60, 50, 100, 25) $NoID = GUICtrlCreateButton($No, 175, 50, 100, 25) GUISetState() Do If WinActive($Title, "") Then $Info = GUIGetCursorInfo() $msg = GUIGetMsg() Select Case $msg = $YesID If $State = 1 Then _Message(1) Else _Message(0) EndIf Case $msg = $NoID If $State = 0 Then _Message(1) Else _Message(0) EndIf EndSelect If $Info[4] = 5 And $Active = 0 Then _Button() $Active = 1 EndIf If $Info[4] = 4 And $Active = 1 Then _Button() $Active = 0 EndIf If $Lock = 1 Then _Enable() Else _Disable() EndIf Else _Disable() EndIf Until $msg = -3 EndFunc ;==>_MainGui I'm still trying to merge the _Enable() and _Disable() Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now