Jump to content

Can't Read Text...


Recommended Posts

Hello I just bought Diablo 2 it is a great game.

I wanted to make a basic script for it and since I don't like cheating bots were out of the question, so I decided to make a launcher for diablo but I though why bother making it if I could just launch the exe and then I had an idea to add a few more things to the launcher, for example

- auto login

- cd key viewer

- character names

but the problem is when I was trying to read the cd keys

since the cd key is hidden in the diablo folder in a 2 mb file I decided the autoit bot would be slow opening these files so I used this file

but the problem is I can't read the text from the window not sure why.

[edited] yea I am sorry it's an exe file, but it can't be helped I don't know how to crack it. If you guys want i can give you the link for it

d2skey.exe

Edited by testingtest
Link to comment
Share on other sites

since its a console application i'd suggest you try to read/write from/to it with Run & StdOutRead/StdInWrite.

I hate to ask but can you give a short example of how I can read from it. Ill try to get it to work but if I fail I can look at your example. I would also like to thank you for helping me and trusting the exe file

[edited]

heres my first attempt Ill keep trying

#include <Constants.au3>
Opt("WinTitleMatchMode", 2)
$script = "d2skey"
$run = Run(@ComSpec & " /k " & $script&".exe" , "" , @SW_SHOW)
Sleep(1000)
Send("1")
;ProcessClose("cmd.exe")

While 1
    $line = StdoutRead($run)
    If @error Then ExitLoop
    MsgBox(0, "STDOUT read:", $line)
Wend

While 1
    $line = StderrRead($run)
    If @error Then ExitLoop
    MsgBox(0, "STDERR read:", $line)
Wend

MsgBox(0, "Debug", "Exiting...")
Edited by testingtest
Link to comment
Share on other sites

i didnt start it, just opened it with an pe editor :whistle:

$iPid = Run(@ComSpec,"",@SW_HIDE,1+2+4) ; the old command prompt
StdinWrite($iPid,"dir" & @CRLF) ; list current directory
StdinWrite($iPid,"exit" & @CRLF) ; Close it
While 1
    $iPeek = StdoutRead($iPid,0,True)
    If @error Then ExitLoop ; error or EOF
    If $iPeek > 0 Then ConsoleWrite(StdoutRead($iPid,$iPeek))
WEnd
CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

i didnt start it, just opened it with an pe editor :whistle:

$iPid = Run(@ComSpec,"",@SW_HIDE,1+2+4) ; the old command prompt
StdinWrite($iPid,"dir" & @CRLF) ; list current directory
StdinWrite($iPid,"exit" & @CRLF) ; Close it
While 1
    $iPeek = StdoutRead($iPid,0,True)
    If @error Then ExitLoop ; error or EOF
    If $iPeek > 0 Then ConsoleWrite(StdoutRead($iPid,$iPeek))
WEndoÝ÷ Ûú®¢×­©ä²)e¶¼­«Hj[(~(.­çhºÜ!Êh§yØmÂä!ú+m+)j»ZºÚ"µÍÌÍÔÕTÐÒS
È  ÌÍÔÕÕUÐÒS

thanks for your help :P

Link to comment
Share on other sites

ok now i started it :whistle:

$sTitle = "Heeeeelllloooooo"
$iPid = Run(@ComSpec,"",@SW_SHOW,1+2+4)
StdinWrite($iPid,'Title ' & $sTitle & @CRLF)
StdinWrite($iPid,"d2skey.exe" & @CRLF)

WinWaitActive($sTitle)
Send("11111111")

$iTimer = TimerInit()
While TimerDiff($iTimer) < 500 ; No output for 500msec
    $iPeek = StdoutRead($iPid,0,True)
    If @error Then ExitLoop ; error or EOF
    If $iPeek > 0 Then 
        ConsoleWrite(StdoutRead($iPid,$iPeek))
        $iTimer = TimerInit()
    EndIf
    
    $iPeek = StderrRead($iPid,0,True)
    If @error Then ExitLoop ; error or EOF
    If $iPeek > 0 Then 
        ConsoleWrite(StderrRead($iPid,$iPeek))
        $iTimer = TimerInit()
    EndIf
WEnd    

StdinWrite($iPid,"exit" & @CRLF)
CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
Link to comment
Share on other sites

ok now i started it :whistle:

$sTitle = "Heeeeelllloooooo"
$iPid = Run(@ComSpec,"",@SW_SHOW,1+2+4)
StdinWrite($iPid,'Title ' & $sTitle & @CRLF)
StdinWrite($iPid,"d2skey.exe" & @CRLF)

WinWaitActive($sTitle)
Send("11111111")

$iTimer = TimerInit()
While TimerDiff($iTimer) < 500 ; No output for 500msec
    $iPeek = StdoutRead($iPid,0,True)
    If @error Then ExitLoop ; error or EOF
    If $iPeek > 0 Then 
        ConsoleWrite(StdoutRead($iPid,$iPeek))
        $iTimer = TimerInit()
    EndIf
    
    $iPeek = StderrRead($iPid,0,True)
    If @error Then ExitLoop ; error or EOF
    If $iPeek > 0 Then 
        ConsoleWrite(StderrRead($iPid,$iPeek))
        $iTimer = TimerInit()
    EndIf
WEnd    

StdinWrite($iPid,"exit" & @CRLF)
wow thanks that solves my problem
Link to comment
Share on other sites

ok one more quick question, when you run the exe file you have to click inside of the console or else it can't send("1") withing the console and it doesn't write the file proper.

I tried many things such as wingetpos mouseclick on it, controlclick doesn't work becuase its not a control didn't work for me either hmm

I think I could use alt-enter though

Edited by testingtest
Link to comment
Share on other sites

did you try WinSetState or WinActivate?

there was some ControlSend trick to sent keys to a console window, but i dont remember...

i also rember seeing a udf on the forum somwhere which was able to send keys or mouse events to a hidden window.

i guess it utilized the sendmessage API but i'm not sure if it works the same way for console windows as it does for normal ones...

hmm... guess i'm getting old :whistle:

CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
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...