Rex Mundi Posted February 25, 2007 Posted February 25, 2007 (edited) Hi, I try to make a script where I can input a text with e.g. the "InputBox" command, then write it in to an .ini file with "IniWrite", and finally rewrite it somewhere else using "IniRead" (e.g. in a program or in the example to notepad). This is what I came up with! CODE $acc = InputBox("Account", "Enter account name", "", "") IniWrite("account.ini", "acc", "key", $acc) $acc1 = IniRead("account.ini", "acc", "key", "") Sleep(1000) Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send($acc1) So far so good, but my problem is that I would like the account.ini to keep the old key values next time I run the script, and I would also like to be able to input a random number of key's to the account.ini file, e.g. the first time I run the script I would maybe need to enter 3 key's and the next time 5 key's. So, can anyone tell me if/how that can be done. Thanks a lot Cheers, Rex Edited February 26, 2007 by Rex Mundi
Valuater Posted February 25, 2007 Posted February 25, 2007 Merry Christmas expandcollapse popup#include <GUIConstants.au3> Dim $Ini_File = @ScriptDir & "\account.ini" Dim $acc1 Dim $num = Random(3, 5, 1) Dim $input[$num + 1], $info[$num + 1] Dim $top = 10 GUICreate(" My GUI input", 220, 220) For $x = 1 To $num $input[$x] = GUICtrlCreateInput("", 10, $top, 100, 20) $info[$x] = IniRead($Ini_File, "acc", $x, "") GUICtrlSetData(-1, $info[$x]) $top += 35 Next $btn = GUICtrlCreateButton("Ok", 40, 190, 60, 20) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn For $x = 1 To $num $info[$x] = GUICtrlRead($input[$x]) IniWrite($Ini_File, "acc", $x, $info[$x] ) Next ; do what you want from here.... test notepad Run("notepad.exe") WinWaitActive("Untitled - Notepad") For $x = 1 To $num Send($info[$x] & @CRLF) Next EndSelect WEnd 8)
Rex Mundi Posted February 26, 2007 Author Posted February 26, 2007 Wow... A lot more complicated than I had hoped it would be.. I don't understand a s... of that code hehe. (I think I need an intensive one man course with a private teacher to learn this! ^^) But.. Even though I don't understand the code, the script still not does what I wanted it to do. Ill try to explain. 1: I would like the window to have only one field to write in - But, either have the window to pop up again when I press [ok] so I can add more key's, or have an [apply] button also, so I can press [apply] to add key's as many times as I want to, and when I press the [ok] the window will close, and the script continues. 2: Also, I need the account.ini to remember everything, so the next time I run the script it will add new key's under the keys thats already there, instead of overwriting them. This is probably very difficult to make, and my skills dont reach that far yet, and that is of cause why I have to ask you guys for your help, but I really hope that some have a solution for me.. Or live close to me so I can have that course.. Cheers, Rex
Rex Mundi Posted February 26, 2007 Author Posted February 26, 2007 Hey guys.. I really need some help here.. I found out how to make only one write field in the window, and I also made one more button.. Now I just need to make it work.. So once again, please help me if you can. expandcollapse popup#include <GUIConstants.au3> Dim $Ini_File = @ScriptDir & "\account.ini" Dim $acc1 ;Dim $num = Random(3, 5, 1) Dim $num = 1 Dim $input[$num + 1], $info[$num + 1] Dim $top = 10 GUICreate("Account Squelch.", 220, 80) For $x = 1 To $num $input[$x] = GUICtrlCreateInput("", 30, $top, 160, 20) $info[$x] = IniRead($Ini_File, "acc", $x, "") GUICtrlSetData(-1, $info[$x]) $top += 35 Next ;I need this button to add text to the account.ini $btn = GUICtrlCreateButton("Add", 40, 45, 60, 20) ;I need this button to close the window and run the rest of the script $btn2 = GUICtrlCreateButton("Finnish", 120, 45, 60, 20) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $btn2 For $x = 1 To $num $info[$x] = GUICtrlRead($input[$x]) IniWrite($Ini_File, "acc", $x, $info[$x] ) Next ; do what you want from here.... test notepad Run("notepad.exe") WinWaitActive("Untitled - Notepad") For $x = 1 To $num Send($info[$x] & @CRLF) Next EndSelect WEnd I need to go to bed now, but I hope to se a lot of nice ideas tomorrow.. Cheers, Rex
Rex Mundi Posted February 27, 2007 Author Posted February 27, 2007 Is it really true that none of you guys are able to help me with this?.. Please help me out here, There is no way I can solve this myself.. Cheers, Rex
Rex Mundi Posted March 1, 2007 Author Posted March 1, 2007 Well, thanks to Valuater for trying. But I think it's sad that a community this big, with so many skilled scripters, wasnt able to help me, even though the post has been viewed by more then 100 people. Rex
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now