Jump to content
Sign in to follow this  

Run program from registry

Recommended Posts


Func  _Diablo_Run()($iMode = -1, $iWait = 5)
    If $iMode = -1 And ProcessExists("game.exe") Then Return 1
    Local $iAutoItVersion_Compare = _VersionCompareEx(@AutoItVersion, "")
    If $iAutoItVersion_Compare <= 0 Then Local $iOld_Opt_REF = Opt("RunErrorsFatal", 0)
    Local $iError = 0, $iPID
    Local $sDiabloII_RegPath = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Blizzard Entertainment\DiabloII", "")
    If FileExists($sDiabloII_RegPath) Then
        $iPID = Run($sDiabloII_RegPath & "\Diablo2.exe")
        $iError = @error
        $iError = 1
    If $iAutoItVersion_Compare <= 0 Then Opt("RunErrorsFatal", $iOld_Opt_REF)
    If $iWait And Not $iError Then
        ProcessWait($iPID, $iWait)
        WinWait($sDiabloII_CLASS, "", $iWait)
    If $iError Then Return SetError(1, 0, 0)
    Return 1
EndFunc   ;==> Diablo II Start

Adding screen of registry from HKEY_LOCAL_MACHINE\SOFTWARE\Blizzard Entertainment\DiabloII

That what i have here dont wanna work . Can any 1 help me ?


Edited by Gordoni

Share this post

Link to post
Share on other sites


I dont see the valuename in your regread:

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Blizzard Entertainment\DiabloII", "")

As per the helfile:

RegRead ( "keyname", "valuename" )


Share this post

Link to post
Share on other sites

Yep..the way you have it it's reading the (default) key if it exists..I think you want to read the InstallPath value

RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Blizzard Entertainment\DiabloII", "InstallPath")

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
Sign in to follow this