hani-dev Posted May 25, 2017 Share Posted May 25, 2017 hello all .... im trying to code a tool that rub from cmd not gui tool my code #pragma compile(Console, True) #include <MsgBoxConstants.au3> ConsoleWrite("coded byy hani |" & @CRLF ) $p = ConsoleWrite("| [ Press 1 ]|" & @CRLF ) $g = ConsoleWrite("| [ Press 2 ]|" & @CRLF ) $i = ConsoleWrite("| [ Press 3 ]|" & @CRLF ) $i = ConsoleWrite("_____________________________________________________________" & @CRLF ) how i can make this lines read my input and then run msgbox for example if the user press 1 the msgbox will executed if the user write 2 the other msgbox executed Link to comment Share on other sites More sharing options...
junkew Posted May 25, 2017 Share Posted May 25, 2017 See help stdout stdread FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
hani-dev Posted May 25, 2017 Author Share Posted May 25, 2017 (edited) 14 minutes ago, junkew said: See help stdout stdread i read it but i did not understand how to add them to my code i need a simple example to show msgbox Edited May 25, 2017 by hani-dev Link to comment Share on other sites More sharing options...
Gianni Posted May 25, 2017 Share Posted May 25, 2017 have a look to _IsPressed() #pragma compile(Console, True) #include <MsgBoxConstants.au3> #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") ConsoleWrite("coded byy hani |" & @CRLF ) $p = ConsoleWrite("| [ Press 1 ]|" & @CRLF ) $g = ConsoleWrite("| [ Press 2 ]|" & @CRLF ) $i = ConsoleWrite("| [ Press 3 to exit]|" & @CRLF ) $i = ConsoleWrite("_____________________________________________________________" & @CRLF ) While 1 if _IsPressed("31", $hDLL) Or _IsPressed("61", $hDLL) Then MsgBox(0,0, "You pressed 1", 1) if _IsPressed("32", $hDLL) Or _IsPressed("62", $hDLL) Then MsgBox(0,0, "You pressed 2", 1) if _IsPressed("33", $hDLL) Or _IsPressed("63", $hDLL) Then MsgBox(0,0, "You pressed 3" & @CRLF & "script will exit in 2 second", 2) ConsoleWrite("Bye" & @CRLF) Exit EndIf Sleep(50) WEnd hani-dev 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
hani-dev Posted May 25, 2017 Author Share Posted May 25, 2017 8 hours ago, Chimp said: have a look to _IsPressed() #pragma compile(Console, True) #include <MsgBoxConstants.au3> #include <Misc.au3> Local $hDLL = DllOpen("user32.dll") ConsoleWrite("coded byy hani |" & @CRLF ) $p = ConsoleWrite("| [ Press 1 ]|" & @CRLF ) $g = ConsoleWrite("| [ Press 2 ]|" & @CRLF ) $i = ConsoleWrite("| [ Press 3 to exit]|" & @CRLF ) $i = ConsoleWrite("_____________________________________________________________" & @CRLF ) While 1 if _IsPressed("31", $hDLL) Or _IsPressed("61", $hDLL) Then MsgBox(0,0, "You pressed 1", 1) if _IsPressed("32", $hDLL) Or _IsPressed("62", $hDLL) Then MsgBox(0,0, "You pressed 2", 1) if _IsPressed("33", $hDLL) Or _IsPressed("63", $hDLL) Then MsgBox(0,0, "You pressed 3" & @CRLF & "script will exit in 2 second", 2) ConsoleWrite("Bye" & @CRLF) Exit EndIf Sleep(50) WEnd wow u are my hero <3 that's what i need thank u very much 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