Jump to content

error with save... load... and startup load...


Recommended Posts

hi everyone...

Im trying to make an autologin for a game i play called runescape...

I made this script for a diffrent script... so it has some very old code in it... but now i have no idea waht i have dealted or messed up so im asking for help...

Im having a problem... it sends 0 for the first input and 0 for the second input... can anyone help....

And can someone take away the menu and add a check box that saves the info and will the load this info every time!!!

Excample:

Input box one has 'ashley' typed intoit

Input box two has 'bob' typed in to it

WHen i press 'F1' it sends:

input box one as '0'

and input box 2 as '0'

... I have no idea what ive done wrong!

CODE
#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1) ; Added this since it looks like you using on event mode for your GUI

Opt("TrayMenuMode", 1) ;Added this to only show Autotalker tray menu options

Opt("TrayOnEventMode", 1) ;Added this for tray menu to work on event as well

TraySetClick(16) ; Set tray menu to show when right mouse click

Global $input[13], $Hide[1], $SettingsPath[1], $label[13] ; Just some arrays for storing settings etc

HotKeySet("^s", "Save") ; This is to call save settings function

HotKeySet("^l", "Load") ; This is to call load settings function

HotKeySet("^h", "Hide") ; This is to call hide function, toggles hide or show gui

HotKeySet("!{ESC}", "Close") ; This is to call close function, this way a user can exit autotalker even if the gui is hidden

HotKeySet("{F1}", "F1")

$Main = GUICreate("Auto-Login- By J4g3xm4n", 450, 100) ;Put your main window in a variable so you can use it on an event.

WinSetOnTop("Auto-Login- By J4g3xm4n", "", 1)

;---- Gui Labels

GUICtrlCreateLabel("Really easy to use just press F1 and this will type in your username and password!", 5, 65)

;----- Gui Menu

$MenuItem2 = GUICtrlCreateMenu("File")

$MenuItem7 = GUICtrlCreateMenuItem("Load Settings (CTRL + L)", $MenuItem2) ;Load settings File Menu

GUICtrlSetOnEvent(-1, 'Load') ; Added this so your gui will call load function when a user selects load from the File Menu

$MenuItem4 = GUICtrlCreateMenuItem("Save Settings (CTRL + S)", $MenuItem2)

GUICtrlSetOnEvent(-1, 'Save') ; Added this so your gui will call save function when a user selects save from the File Menu

GUICtrlCreateMenuItem('', $MenuItem2) ; Divider line in menu , cosmetic touch...lol

$MenuItem8 = GUICtrlCreateMenuItem("Hide (CTRL + H)", $MenuItem2)

GUICtrlSetOnEvent(-1, 'Hide') ; Added this so your gui will call hide function when a user selects hide from the File Menu

GUICtrlCreateMenuItem('', $MenuItem2) ; Divider line in menu , cosmetic touch...lol

$MenuItem3 = GUICtrlCreateMenuItem("EXIT (ALT + ESC)", $MenuItem2)

GUICtrlSetOnEvent(-1, 'Close') ; Added this so your gui will call close function when a user selects exit from the File Menu

$MenuItem1 = GUICtrlCreateMenu("Other")

$MenuItem5 = GUICtrlCreateMenuItem("About", $MenuItem1)

GUICtrlSetOnEvent(-1, 'About') ; Added this so your gui will call about function when a user selects about from the File Menu

$MenuItem6 = GUICtrlCreateMenuItem("Version", $MenuItem1)

GUICtrlSetOnEvent(-1, 'Version') ; Added this so your gui will call version function when a user selects version from the File Menu

;---- Gui Input Boxes

$input1 = GUICtrlCreateInput("type your username here", 25, 10)

$input2 = GUICtrlCreateInput("type your password here", 25, 35)

GUISetOnEvent($GUI_EVENT_CLOSE, 'Close') ; Added this so your GUI will call a function to exit

GUISetOnEvent($GUI_EVENT_MINIMIZE, 'Hide') ; Added this so your GUI will call a function to hide gui

GUISetState()

;--- Tray Menu

$HideShow = TrayCreateItem('Hide Auto-Login', -1, 0)

TrayItemSetOnEvent(-1, "Hide")

TrayCreateItem('', -1, 1) ;Divider line in tray menu , cosmetic touch...lol

$Load = TrayCreateItem('Load Settings', -1, 2)

TrayItemSetOnEvent(-1, "Load")

$Save = TrayCreateItem('Save Settings', -1, 3)

TrayItemSetOnEvent(-1, "Save")

TrayCreateItem('', -1, 4) ;Divider line in tray menu , cosmetic touch...lol

$Close = TrayCreateItem('Exit', -1, 5)

TrayItemSetOnEvent(-1, "Close")

TraySetState()

StartupLoad() ;Load settings from Auto-Login.ini if it exists in the script directory.

While 1

Sleep(10)

WEnd

;~ Func Menu

Func F1()

GUICtrlRead($input[1])

Send(GUICtrlRead($input[1]))

Send("{ENTER}")

GUICtrlRead($input[2])

Send(GUICtrlRead($input[2]))

EndFunc ;==>F1

Func Hide() ; Toggle hide or show the gui function.

If $Hide[0] = 1 Then

GUISetState(@SW_SHOW, $Main)

If BitAND(WinGetState("Auto-Login- By J4g3xm4n", ""), 16) Then

WinSetState("Auto-Login- By J4g3xm4n", '', @SW_RESTORE)

EndIf

WinSetOnTop("Auto-Login- By J4g3xm4n", "", 1)

$Hide[0] = 0

TrayItemSetText($HideShow, 'Hide Auto-Login')

ElseIf $Hide[0] = 0 Then

GUISetState(@SW_HIDE, $Main)

$Hide[0] = 1

TrayItemSetText($HideShow, 'Show Auto-Login')

EndIf

EndFunc ;==>Hide

Func Save() ;Save the settings to an ini when a user select Save from File Menu, Hotkey or Tray. Settings will be saved to loaded ini if it's got write access.

If FileExists($SettingsPath[0]) Then

For $i = 1 To 12

$SaveIni1 = IniWrite($SettingsPath[0], 'Settings', 'F' & $i, GUICtrlRead($input[$i]))

Next

If $SaveIni1 <> 1 Then

For $i = 1 To 12

$SaveIni = IniWrite(@ScriptDir & '\Auto-Login.ini', 'Settings', 'F' & $i, GUICtrlRead($input[$i]))

Next

If $SaveIni = 1 Then

$SettingsPath[0] = @ScriptDir & '\Auto-Login.ini'

ElseIf $SaveIni <> 1 Then ;If the script is run from read only directory then offer the user where to save the settings.

WinSetOnTop("Auto-Login- By J4g3xm4n", "", 0)

$SaveFile = FileSaveDialog('Save Auto-Login settings to ...', '::{450D8FBA-AD25-11D0-98A8-0800361B1103}', 'Auto-Login (*.ini)', 18, 'Auto-Login.ini')

If Not @error = 1 Then

For $i = 1 To 12

$SaveIni2 = IniWrite($SaveFile, 'Settings', 'F' & $i, GUICtrlRead($input[$i]))

Next

$SettingsPath[0] = $SaveFile

EndIf

WinSetOnTop("Auto-Login- By J4g3xm4n", "", 1)

EndIf

EndIf

ElseIf Not FileExists($SettingsPath[0]) Then ; <- Start updated, this was the part I forgot to add when there's no ini path stored in array

For $i = 1 To 12

$SaveIni = IniWrite(@ScriptDir & '\Autotalker.ini', 'Settings', 'F' & $i, GUICtrlRead($input[$i]))

Next

If $SaveIni = 1 Then

$SettingsPath[0] = @ScriptDir & '\Auto-Login.ini'

ElseIf $SaveIni <> 1 Then

WinSetOnTop("Auto-Login- By J4g3xm4n", "", 0)

$SaveFile = FileSaveDialog('Save Auto-Login settings to ...', '::{450D8FBA-AD25-11D0-98A8-0800361B1103}', 'Auto-Login (*.ini)', 18, 'Auto-Login.ini')

If Not @error = 1 Then

For $i = 1 To 12

$SaveIni2 = IniWrite($SaveFile, 'Settings', 'F' & $i, GUICtrlRead($input[$i]))

Next

$SettingsPath[0] = $SaveFile

EndIf

WinSetOnTop("Auto-Login- By J4g3xm4n", "", 1)

EndIf

EndIf ;<- This is the end of what I updated

EndFunc ;==>Save

Func Load() ; File Menu Load settings from an ini that the user has saved somewhere.

WinSetOnTop("Auto-Login- By J4g3xm4n", "", 0)

$FileLoad = FileOpenDialog('Load Auto-Login settings from...', '::{450D8FBA-AD25-11D0-98A8-0800361B1103}', '(Auto-Login.ini)|(*.ini)', 3, 'Auto-Login.ini')

If Not @error = 1 Then

$ReadSection = IniReadSection($FileLoad, 'Settings')

For $i = 1 To 12

GUICtrlSetData($input[$i], $ReadSection[$i][1])

Next

$SettingsPath[0] = $FileLoad

EndIf

WinSetOnTop("Auto-Login- By Jag3xm4n", "", 1)

EndFunc ;==>Load

Func StartupLoad() ;On startup load settings from ini if it exists into the input boxes. Default the ini will be loaded from script directory when started

If FileExists(@ScriptDir & '\Auto-Login.ini') Then

$ReadSection = IniReadSection(@ScriptDir & '\Auto-Login.ini', 'Settings')

For $i = 1 To 12

GUICtrlSetData($input[$i], $ReadSection[$i][1])

Next

EndIf

EndFunc ;==>StartupLoad

Func About() ; Other File Menu About function

WinSetOnTop("Auto-Login- By Jag3xm4n", "", 0)

MsgBox(64, 'About Auto-Login', 'Made for runescape' & @CRLF & 'this little basic program will log you in when u press F1' & _

@CRLF & 'For more information... Go to www.j4g3xm4n')

WinSetOnTop("Auto-Login- By Jag3xm4n", "", 1)

EndFunc ;==>About

Func Version() ; Other File Menu Version function

WinSetOnTop("Auto-Login- By J4g3xm4n", "", 0)

MsgBox(64, 'Auto-Login Version', 'V.1.00 ')

WinSetOnTop("Auto-Login- By J4g3xm4n", "", 1)

EndFunc ;==>Version

Func Close() ; This is the function called from GUISetOnEvent to exit.

Exit

EndFunc ;==>Close

plz help

I think the problems to do with the input boxes

Edited by SalazarCheats

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

Ive edited it:::

Check first post..,

Ive have gave an excample i told u were i think the problem lies

Not sure why you created $input[13]

Instead of changing everything

I just assigned

$input[1] =$input1

and

$input[2] =$input2

and then you won't get 0 but the required input you entered.

Edited by 1905russell
Link to comment
Share on other sites

Not sure why you created $input[13]

Instead of changing everything

I just assigned

$input[1] =$input1

and

$input[2] =$input2

and then you won't get 0 but the required input you entered.

ok i can find $input[13]

So... can you post the edited script plz

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

ok i can find $input[13]

So... can you post the edited script plz

I did not want to change or disturb your code. I wanted you to do it.

So I assigned the variables to what you were trying to do. As follows:

$input1 =GUICtrlCreateInput("type your username here", 25, 10)

$input[1] =$input1

$input2 = GUICtrlCreateInput("type your password here", 25, 35)

$input[2] = $input2

You dont have to do this, you can just change your code

$input[1] =GUICtrlCreateInput("type your username here", 25, 10)

$input[2] = GUICtrlCreateInput("type your password here", 25, 35)

You know you are displaying these variables appended to the input line?

Good luck.

Link to comment
Share on other sites

I did not want to change or disturb your code. I wanted you to do it.

So I assigned the variables to what you were trying to do. As follows:

$input1 =GUICtrlCreateInput("type your username here", 25, 10)

$input[1] =$input1

$input2 = GUICtrlCreateInput("type your password here", 25, 35)

$input[2] = $input2

You dont have to do this, you can just change your code

$input[1] =GUICtrlCreateInput("type your username here", 25, 10)

$input[2] = GUICtrlCreateInput("type your password here", 25, 35)

You know you are displaying these variables appended to the input line?

Good luck.

thank you...

it worked now is there any way to make the save bit a checkbox... so if checked it would save... and then load this everytime!!!

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

thank you...

it worked now is there any way to make the save bit a checkbox... so if checked it would save... and then load this everytime!!!

Problem... now it wont save!!!

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

Problem... now it wont save!!!

You say above that you have edited the script - not sure where and how.

You are going to have continuous problems with this script.

It won't save that's true, it also won't load or startupload or anything else.

There are many problems with this script and I know once you have your save problem working, youll have many more questions. Im sure you never wrote this script and it seems you are basically asking someone to make the whole thing work for you without understanding whats going on.

Firstly whoever wrote this script must have provided a template for the Auto-Login.ini file. This is where your save goes. This file needs to be setup in the script directory and its key is [settings]. Do this first. The script at StartupLoad() should, if it doesnt exist, set it up (but it doesnt).

Also some variables need to be changed and assigned values.

E.g. Global $SettingsPath[1] is created and never assigned a value and then $SettingsPath[0] is referenced all over the place also with no values?

To get this to work just eliminate the sub-script and initialize as follows:

Global $SettingsPath = "@ScriptDir & '\Auto-Login.ini'"

And change everywhere $SettingsPath[0] to $SettingsPath

Its still a lousy name for this variable but save will work now (as you requested) and then give you your next set of problems.

As a skeleton script this code looks okay but unfortunately it requires many changes to make it work. Your thread is headed error with send keys but it has nothing to do with Send().You are trying to fix someone elses script piecemeal one problem at a time. You have to learn to understand the program flow and trap these problems to isolate them.

Cheers

Link to comment
Share on other sites

You say above that you have edited the script - not sure where and how.

You are going to have continuous problems with this script.

It won't save that's true, it also won't load or startupload or anything else.

There are many problems with this script and I know once you have your save problem working, youll have many more questions. Im sure you never wrote this script and it seems you are basically asking someone to make the whole thing work for you without understanding whats going on.

Firstly whoever wrote this script must have provided a template for the Auto-Login.ini file. This is where your save goes. This file needs to be setup in the script directory and its key is [settings]. Do this first. The script at StartupLoad() should, if it doesnt exist, set it up (but it doesnt).

Also some variables need to be changed and assigned values.

E.g. Global $SettingsPath[1] is created and never assigned a value and then $SettingsPath[0] is referenced all over the place also with no values?

To get this to work just eliminate the sub-script and initialize as follows:

Global $SettingsPath = "@ScriptDir & '\Auto-Login.ini'"

And change everywhere $SettingsPath[0] to $SettingsPath

Its still a lousy name for this variable but save will work now (as you requested) and then give you your next set of problems.

As a skeleton script this code looks okay but unfortunately it requires many changes to make it work. Your thread is headed error with send keys but it has nothing to do with Send().You are trying to fix someone elses script piecemeal one problem at a time. You have to learn to understand the program flow and trap these problems to isolate them.

Cheers

ok if you the first post i made... i said this is one of my very old scripts that i made but i ahve deleted some parts and changed a few thing...

the orignal script i made this opne form had 11 send() hotkeys in it... it was an autotalker for 'runescape'

but now i have no idea waht i have dealted or messed up so im asking for help...

And when i posted this it didnt send the correct thing so it did have someting to do with send()

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

ok if you the first post i made... i said this is one of my very old scripts that i made but i ahve deleted some parts and changed a few thing...

the orignal script i made this opne form had 11 send() hotkeys in it... it was an autotalker for 'runescape'

but now i have no idea waht i have dealted or messed up so im asking for help...

And when i posted this it didnt send the correct thing so it did have someting to do with send()

I now understand that Send() was the messenger of the problem. Okay.

If you wrote that script then why have you needed help twice with just changing variable names?

You didnt need me to tell you that an ini file was needed?

Anyway nice script.

Link to comment
Share on other sites

I now understand that Send() was the messenger of the problem. Okay.

If you wrote that script then why have you needed help twice with just changing variable names?

You didnt need me to tell you that an ini file was needed?

Anyway nice script.

still getting errors

Ok im 14 with a spelling age of a 9 year old... that explanes all my spelling mistakes

Link to comment
Share on other sites

still getting errors

Okay forget my last post, don't change anything and lets go back to

Problem... now it wont save!!!

It is saving in a file called Autotalker.ini which it creates if it does not exist.

So that answers that question. I hope you get it to work again.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...