Sign in to follow this  
Followers 0
BluhBlah

Script read from config.ini

2 posts in this topic

How can i make my script read from a ini file etc: Leave delay: and Password: Would change those lines

Send ("123") ;Password

Sleep (5000)

and make the 123 and 5000the thing it says in the ini file.. I readed in help file but i didnt rly get it :/

Dim $stop = 0
HotKeySet("{F4}", "toggel")
HotKeySet("{F5}", "off")
While 1
    If $stop = 1 Then
    If PixelGetColor(167, 86) = 0xFFF052 Then  ; Press B to enter bnet
    Send ("B")
    Sleep ("5000")
EndIf
    If PixelGetColor(260, 361) = 0x111111 Then ; Type password to enter game
    Send ("123") ;Password
    Send ("{ENTER}")
    Sleep (10000)
EndIf
    If PixelGetColor(209, 629) = 0xDD9C03 Then ; See if its ingame!
    Sleep (5000)
    Send ("!Q")
EndIf
    If PixelGetColor(671, 295) = 0x111111 Then Send ("{ENTER}") ; If wrong password screen come up it press enter
    If PixelGetColor(28, 157) = 0x5C594D Then Send ("!Q") ; Sends search game if it is in ..channel
    If PixelGetColor(346, 393) = 0xEAB2ED Then Send ("Q"); Makes it leave if it get quitscreen
    If PixelGetColor(482, 238) = 0x161605 Then Send ("!Q"); Makes it leave if it get defeat screen!
    If PixelGetColor(1009, 67) = 0x182018 Then Send ("{ENTER}"); Makes it press enter if it get scorescreen
EndIf
WEnd
Func toggel()
    If $stop = 0 Then
        $stop = 1
    Else
        $stop = 0
    EndIf
EndFunc
Func off()
    Exit
EndFunc
[/Codebox]

Share this post


Link to post
Share on other sites



Iniread(). Store it as a variable then "Send()" the variable.

HotKeySet("{F4}", "toggel")
HotKeySet("{F5}", "off")
$password=Iniread(@ScriptDir&"\settings.ini","Settings","Password","Notfound")
$delay=IniRead(@ScriptDir&"\settings.ini","Settings","Delay",5000)
While 1
    If $stop = 1 Then
    If PixelGetColor(167, 86) = 0xFFF052 Then  ; Press B to enter bnet
    Send ("B")
    Sleep ($delay)
EndIf
    If PixelGetColor(260, 361) = 0x111111 Then ; Type password to enter game
    Send ($password) ;Password
    Send ("{ENTER}")
    Sleep (10000)
EndIf
    If PixelGetColor(209, 629) = 0xDD9C03 Then ; See if its ingame!
    Sleep (5000)
    Send ("!Q")
EndIf
    If PixelGetColor(671, 295) = 0x111111 Then Send ("{ENTER}") ; If wrong password screen come up it press enter
    If PixelGetColor(28, 157) = 0x5C594D Then Send ("!Q") ; Sends search game if it is in ..channel
    If PixelGetColor(346, 393) = 0xEAB2ED Then Send ("Q"); Makes it leave if it get quitscreen
    If PixelGetColor(482, 238) = 0x161605 Then Send ("!Q"); Makes it leave if it get defeat screen!
    If PixelGetColor(1009, 67) = 0x182018 Then Send ("{ENTER}"); Makes it press enter if it get scorescreen
EndIf
WEnd

Func toggel()
    If $stop = 0 Then
        $stop = 1
    Else
        $stop = 0
    EndIf
EndFunc

Func off()
    Exit
EndFunc

With settings.ini looking something like:

[Settings]
Password = 123
Delay = 5000

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  
Followers 0