Sign in to follow this  
Followers 0
Daggett

iniwrite problem

5 posts in this topic

ok i want this script when i press "save Password" to write the password in the data.ini

but for some strange reason it doesn't write the password: [Password]

key=

after key= it has to set the password i entered in the input.

here's my script:

#include <file.au3>

#include <GUIConstants.au3>

opt("GUIOnEventMode",1)

opt ("SendKeyDelay", 0)

;*******************************************************************************

func close ()

Exit

endfunc

hotkeyset ("{esc}", "close")

$savedpassword = iniread (@scriptdir & "\Files\data.ini", "Password", "key", "")

;**********************GUI******************************************************

Guicreate ("ROSE Online Command Centre", 400, 500, -1, -1)

$Passwordbox = GUICtrlCreateInput ($savedpassword, 30 , 30, 100, 17, $ES_PASSWORD)

$zavepassword = GUICtrlCreateButton ("Save Password",30, 47, 80, 18)

guictrlsetonevent ($zavepassword, "writepassword")

$passworder = GUICtrlRead ($Passwordbox)

guisetonevent ($GUI_EVENT_CLOSe, "close")

guisetstate (@sw_show)

;*******************************************************************************

func writepassword ()

  _filecreate (@scriptdir & "\data.ini")

  iniwrite (@scriptdir & "\data.ini", "Password", "key", $passworder)

endfunc

while 1

sleep (100000)

wend

and it does read the password that's in the input because if you use:

run ("notepad.exe")

send ($passworder)

it does type the password that's enterd in the input.


Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

$passworder = GUICtrlRead ($Passwordbox)

This line should be moved to your writePassword() method because otherwise the $passworder variable will only ever contain the saved password.

If that doesn't solve the problem for you then maybe adding this line to the start of your script will:

global $passworder
Edited by LxP

Share this post


Link to post
Share on other sites

:evil: thanks it works!

so simple and i didn't see it :)


Share this post


Link to post
Share on other sites

#include <file.au3>
#include <GUIConstants.au3>
opt("GUIOnEventMode",1)
opt ("SendKeyDelay", 0)

;*******************************************************************************

func close ()
Exit
endfunc
hotkeyset ("{esc}", "close")


$savedpassword = iniread (@scriptdir & "\data.ini", "Password", "key", "")

;**********************GUI******************************************************

Guicreate ("ROSE Online Command Centre", 400, 500, -1, -1)
$Passwordbox = GUICtrlCreateInput ($savedpassword, 30 , 30, 100, 17, $ES_PASSWORD)
$savepassword = GUICtrlCreateButton ("Save Password",30, 47, 80, 18)
guictrlsetonevent ($savepassword, "writepassword")
guisetonevent ($GUI_EVENT_CLOSe, "close")
guisetstate (@sw_show)

;*******************************************************************************

func writepassword ()
    $passworder = GUICtrlRead ($Passwordbox)
  _filecreate (@scriptdir & "\data.ini")
  iniwrite (@scriptdir & "\data.ini", "Password", "key", $passworder)
endfunc

while 1
sleep (100000)
wend

I wanna include a $accountbox.

$Passwordbox = GUICtrlCreateInput ($savedpassword, 30 , 30, 100, 17, ...

$accountbox = GUICtrlCreateInput($savedaccount, 30, 60, 100, 17,...

How do i save the account into the data.ini file please?


Sapiente vince, rex, noli vincere ferro!

Share this post


Link to post
Share on other sites

maybe like this...

Func writepassword ()
    If Not FileExists(@scriptdir & "\data.ini") Then 
        _filecreate (@scriptdir & "\data.ini")
    EndIf   
    $passworder = GUICtrlRead ($Passwordbox)
    iniwrite (@scriptdir & "\data.ini", "Password", "key", $passworder)
    $Accounter = GUICtrlRead ($accountbox )
    iniwrite (@scriptdir & "\data.ini", "Account", "key", $Accounter)
Endfunc

6)


NEWHeader1.png

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