Sign in to follow this  
Followers 0
DeathnLife

Ini read/write.

9 posts in this topic

I got a script that settings from an ini file - it does this fine.

Then I have a GUI displaying some information from this ini - fine.

You then edit the input boxes and click login, at this point it should be rewriting the ini file with new information - I'm nor sure what goes wrong here

Now when i next open it, the fields are 4, 6, 8, 10 and 12 - not text strings.

Really, I don't understand what I'm doing wrong.

Please help me!

#include <GUIConstants.au3>
$iniuser=IniRead("settings.ini", "login", "username", "Login")
$inipass=IniRead("settings.ini", "login", "password", "Password")
$inichar=IniRead("settings.ini", "login", "character", "1")
$inipath=IniRead("settings.ini", "paths", "sropath", "C:\Program Files\Silkroad")
$inibot=IniRead("settings.ini", "paths", "botpath", "C:\Program Files\bot")
Opt("GUIOnEventMode", 1)
$window=GUICreate("Login", 216,128) 
GUICtrlCreateLabel("Login:",5,7,30,20)
$login=GUICtrlCreateInput($iniuser,70,5,85,20,-1)
GUICtrlCreateLabel("Password:",5,34,50,20)
$password=GUICtrlCreateInput($inipass, 70,30,85 , 20,-1)
GUICtrlCreateLabel("Char Nr:",5,58,50,20)
$character=GUICtrlCreateInput($inichar,70,55,20,20,-1)
GUICtrlCreateLabel("Silkroad Dir:",5,84,60,20)
$sropath=GUICtrlCreateInput($inipath,70,80,142,20,-1)
GUICtrlCreateLabel("Silkroad Dir:",5, 109,60,20)
$botpath=GUICtrlCreateInput($inibot,70,105,142,20,-1)
$okbutton=GUICtrlCreateButton("Login",170,10,40)
GUICtrlSetOnEvent($okbutton,"OKButton")
$exitbutton=GUICtrlCreateButton("Exit",170,42,40)
GUICtrlSetOnEvent($exitbutton,"EXITButton")
GUISetOnEvent($GUI_EVENT_CLOSE,"CLOSEClicked")

GUISetState(@SW_SHOW)
While 1
Sleep(50)
WEnd

Func OKButton()
    IniWrite("settings.ini", "login", "username", $login)
    Iniwrite("settings.ini", "login", "password", $password)
    Iniwrite("settings.ini", "login", "character", $character)
    Iniwrite("settings.ini", "paths", "sropath", $sropath)
    Iniwrite("settings.ini", "paths", "botpath", $botpath)
EndFunc

Func EXITButton()
    MsgBox("","Goodbye", "Thank you for using my login script.",3)
    Exit
EndFunc

Func CLOSEClicked()
    Exit
EndFunc

Share this post


Link to post
Share on other sites



You must do a GUICtrlRead to get the text in the input

Share this post


Link to post
Share on other sites

I noticed you don't have a path for your ini files like C:\settings.ini

is there a reason for this

that basically means it creates it in whatever directory its currently running in, kinda like doing an @ScriptDir & "\settings.ini"

Share this post


Link to post
Share on other sites

Can you please put GUICtrlRead into my script please?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Look in the Help File it's quite simple.

or have googe do it for you, for simple stuff just refer to the help file , so they actually learn.

Edited by Thatsgreat2345

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

#include <GUIConstants.au3>
$iniuser=IniRead("settings.ini", "login", "username", "Login")
$inipass=IniRead("settings.ini", "login", "password", "Password")
$inichar=IniRead("settings.ini", "login", "character", "1")
$inipath=IniRead("settings.ini", "paths", "sropath", "C:\Program Files\Silkroad")
$inibot=IniRead("settings.ini", "paths", "botpath", "C:\Program Files\bot")
Opt("GUIOnEventMode", 1)
$window=GUICreate("Login", 216,128)
GUICtrlCreateLabel("Login:",5,7,30,20)
$login=GUICtrlCreateInput($iniuser,70,5,85,20,-1)
GUICtrlCreateLabel("Password:",5,34,50,20)
$password=GUICtrlCreateInput($inipass, 70,30,85 , 20,-1)
GUICtrlCreateLabel("Char Nr:",5,58,50,20)
$character=GUICtrlCreateInput($inichar,70,55,20,20,-1)
GUICtrlCreateLabel("Silkroad Dir:",5,84,60,20)
$sropath=GUICtrlCreateInput($inipath,70,80,142,20,-1)
GUICtrlCreateLabel("Silkroad Dir:",5, 109,60,20)
$botpath=GUICtrlCreateInput($inibot,70,105,142,20,-1)
$okbutton=GUICtrlCreateButton("Login",170,10,40)
GUICtrlSetOnEvent($okbutton,"OKButton")
$exitbutton=GUICtrlCreateButton("Exit",170,42,40)
GUICtrlSetOnEvent($exitbutton,"EXITButton")
GUISetOnEvent($GUI_EVENT_CLOSE,"CLOSEClicked")

GUISetState(@SW_SHOW)
While 1
Sleep(50)
WEnd

Func OKButton()
    IniWrite("settings.ini", "login", "username", GUICtrlRead($login))
    Iniwrite("settings.ini", "login", "password", GUICtrlRead($password))
    Iniwrite("settings.ini", "login", "character", GUICtrlRead($character))
    Iniwrite("settings.ini", "paths", "sropath", GUICtrlRead($sropath))
    Iniwrite("settings.ini", "paths", "botpath", GUICtrlRead($botpath))
EndFunc

Func EXITButton()
    MsgBox("","Goodbye", "Thank you for using my login script.",3)
    Exit
EndFunc

Func CLOSEClicked()
    Exit
EndFunc

Use it like that, when you create controls, the controls handle is returned. It is simply a number. You have to use the GUICtrlRead function to actually read the data that is in the control.

EDIT:

It seems all three of us read the page and started posting at around the same time. :P

Edited by The Kandie Man

"So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire

Share this post


Link to post
Share on other sites

Thank you very much.

Works fine.

Share this post


Link to post
Share on other sites

I see this is for SilkRoad just letting you know, it has GG and this probably won't work well it might yeah for the login screen but if you planning on a bot it wont work.

Share this post


Link to post
Share on other sites

You may also see I'm using iSROBot with this.

(uses it's own GameGuard bypass)

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