Jump to content

keys not sending correctly


t0ddie
 Share

Recommended Posts

I dont know why, but the script i was using that did not work, works today. i changed nothing.

go figure.

anyways, thanks for all the advice guys.

problem solved i guess... heh

Edited by t0ddie

Valik Note Added 19 October 2006 - 08:38 AMAdded to warn level I just plain don't like you.

Link to comment
Share on other sites

Try this:

Opt("WinTitleMatchMode", 2)     ;1=start, 2=subStr, 3=exact, 4=advanced
Opt("SendKeyDelay", 1)          ;milliseconds

FileDelete(@ScriptDir&"\output.txt")
FileDelete(@ScriptDir&"\gen.bat")
FileWriteLine(@ScriptDir&"\gen.bat","d2skey.exe > output.txt")

$pid = run(@comspec,@scriptdir,@SW_HIDE)
$hwnd = _ProcessGetWin($pid)
ControlSend($hwnd,"","","script.bat{enter}")
ControlSend($hwnd,"","","2")
ControlSend($hwnd,"","","1.mpq{enter 2}")
ControlSend($hwnd,"","","exit{enter}")

$output = FileRead(@scriptdir&"\output.txt")
FileDelete(@ScriptDir&"\output.txt")
FileDelete(@ScriptDir&"\gen.bat")

msgbox(0,"Output from d2skey.exe",$output)


func _ProcessGetWin($procID)
    sleep(100)
    $var = WinList()
    For $i = 1 to $var[0][0]
      $thispid = WinGetProcess($var[$i][1])
      if $thispid = $procID then return $var[$i][1]
    Next
EndFunc

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

Link to comment
Share on other sites

The code I wrote works for me when I run it. Place it in the diablo directory with the program. Try changing:

$pid = run(@comspec,@scriptdir,@SW_HIDE)

to

$pid = run(@comspec,@scriptdir)

so that it doesn't run the command window hidden. Also try sprinkling in some

sleep(1000)

comands so that you can see what it's doing. Also try commenting out the FileDeletes, so you can take a look at the Output.txt file it's creating to capture the output from the program. It should be working fine.

[font="Fixedsys"][list][*]All of my AutoIt Example Scripts[*]http://saneasylum.com[/list][/font]

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...