Jump to content

What's wrong with this?


Recommended Posts

Func loadAccountsData()

if FileExists("accs.txt") and FileExists("pwds.txt") Then

$MaxAccs=5

Local $usrs[$MaxAccs]

Local $pwds[$MaxAccs]

Local $acc=FileOpen("accs.txt")

Local $pwd=FileOpen("pwds.txt")

For $i=1 To $MaxAccs Step 1

$usrs[$i] = FileReadLine($acc, $i)

$pwds[$i] = FileReadLine($pwd, $i)

Next

For $i=1 To $MaxAccs Step 1

GUICtrlSetData($UsernamesList, $usrs[$i]&"|")

GUICtrlSetData($PasswordsList, $pwds[$i]&"|")

Next

Else

MsgBox(16, "error", "Either accounts or password files weren't found.")

EndIf

EndFunc

I'm getting this error when I run the script via the SCiTE editor:

C:\Workspace\newgui.au3 (138) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

$usrs[$i] = FileReadLine($acc, $i)

^ ERROR

$UsernamesList and $PassowrdsList are lists created earlier

"The story of a blade is linked in Blood." 

―Yasuo

 

Link to comment
Share on other sites

The array $usrs has 5 elements numbered from 0 to 4. You try to access elements 1 to 5 in your loop. Your script crashes when you try to access the non existant element 5.

Change the loop statement to "For $i=0 To $MaxAccs-1"

There is a very good tutorial explaining arrays in the wiki.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

:oops:

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I have another problem:

Local $usrs[$MaxAccs]

Local $pwds[$MaxAccs]

I declared MaxAccs earlier, at the very start of the script. I want to use the one I declared at the top, not the one I'm forced to put inside the function.

Forced because if I remove that, it tells me that the variable $MaxAccs doesn't exist. I tried adding Global before $MaxAccs, but it still gives me the error. How can I fix?

This is the error I'm talking about: C:Workspacenewgui.au3 (130) : ==> Variable used without being declared.:

Edited by megablox

"The story of a blade is linked in Blood." 

―Yasuo

 

Link to comment
Share on other sites

What error do you get?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Then there is either a typo in the variable declaration or you declare the variable AFTER calling the function.

Could you post the code where you define the variable and where you call the function?

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

line 89 (after koda's gui generation bit) ;

Global $MaxAccs=5

more code down here

line 128;

Func loadAccountsData()
   if FileExists("C:\Program Files (x86)\Blackout RO Bot\dir\accs.txt") and FileExists("C:\Program Files (x86)\Blackout RO Bot\dir\pwds.txt") Then
      Local $usrs[$MaxAccs]
      Local $pwds[$MaxAccs]
      $acc=FileOpen("C:\Program Files (x86)\Blackout RO Bot\dir\accs.txt")
      $pwd=FileOpen("C:\Program Files (x86)\Blackout RO Bot\dir\pwds.txt")
      For $i=0 To $MaxAccs-1 Step 1
         $usrs[$i] = FileReadLine($acc, $i)
         $pwds[$i] = FileReadLine($pwd, $i)
      Next
      For $i=0 To $MaxAccs-1 Step 1
         GUICtrlSetData($UsernamesList, $usrs[$i]&"|")
         GUICtrlSetData($PasswordsList, $pwds[$i]&"|")
      Next
   Else
      MsgBox(16, "bRO - Devotion:error", "Either accounts or password files weren't found.")
   EndIf
EndFunc
Edited by megablox

"The story of a blade is linked in Blood." 

―Yasuo

 

Link to comment
Share on other sites

Is the semicolon in your code?

; Global $MaxAccs=5

If it is then this statement is a comment and hence the variable is not defined.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I have to leave now but will have a look at your code later!

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

Hi, megablox. Can you give some more info on the app, that may be part of your issue. I see Blackout RO Bot in your program files. Is this for Ragnarok online, or is it something else?

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

@JLogan3o13

Good point.

@megablox

I hope you've read the forum rules, if not you can find them here. Make sure you read the part regarding games thoroughly.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

@water Yes, I know I can't do bots. This is just a simple auto-login macro, nothing else. I am not that skilled to make a bot.

@JLogan Yes, this is related to Ragnarok Online.

What I was doing here is create a GUI, then have it automatically load the usernames and passwords from a list, then you would choose the account you wanted to log with and click a button, then the login process would automate.

That's all, but it doesn't seem to work :oops:

"The story of a blade is linked in Blood." 

―Yasuo

 

Link to comment
Share on other sites

The forum rules include this sentence:

"SPAM tools including instant messenger or forum auto-posters. This includes forum or site auto-login methods."

I emphasized the important part relating to this thread.

I'm not sure how a Mod sees it but I fear this thread will soon be locked.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

  • Moderators

megablox,

This is just a simple auto-login macro

Yes, this is related to Ragnarok Online

So you break the Forum Rules on 2 counts. Make sure you read and understand them before you post again. :oops:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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