hani-dev

autoit in ms dos mode tool !!

5 posts in this topic

#1 ·  Posted

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 

 

Share this post


Link to post
Share on other sites



#3 ·  Posted (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 by hani-dev

Share this post


Link to post
Share on other sites

#4 ·  Posted

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

 

1 person likes this

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

Share this post


Link to post
Share on other sites

#5 ·  Posted

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 

Share this post


Link to post
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