Overflow_

_FileReadToArray + _StringBetween

3 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

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

Share this post


Link to post
Share on other sites

nice, thanks bud.

 

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