Jump to content

_FileReadToArray + _StringBetween


Recommended Posts

Hello, Anyone can tell me why i got this error ?

"C:\Users\Saymyname\Desktop\test.au3" (18) : ==> Subscript used on non-accessible variable.:
_ReplaceStringInFile($Last, $Check[0], "OneFuckinRndString")
_ReplaceStringInFile($Last, $Check^ ERROR

 

Func _rnd($sDir)
   Local $sArray

   FileCopy($sDir, @ScriptDir & "\Random.txt")
   _FileReadToArray("Random.txt", $sArray)

   For $i = 1 To Ubound($sArray) - 1
       $Check = _StringBetween( $sArray[$I], '$', ' ') ; function (
       $Last = "Random.txt"
       FileRead($Last, FileGetSize($Last))
       _ReplaceStringInFile($Last, $Check[0], "OneFuckinRndString")
   Next

EndFunc

 

in file, i have only this:

$string1 = null

$string2 = null

$string3 = null

Link to comment
Share on other sites

Do an IsArray on $Check prior to your replacestringinfile, If it fails skip that function because there will be no $Check[0]

Edited by iamtheky

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

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...