Jump to content

autoit in ms dos mode tool !!


Recommended Posts

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

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 by hani-dev
Link to comment
Share on other sites

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

 

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Link to comment
Share on other sites

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...