Sign in to follow this  
Followers 0
vin1

Array error

4 posts in this topic

I have this script that gives an error, how to fix it?

 

#include <File.au3>
$file = @DesktopDir & "\temp.txt"
$file_output = @DesktopDir & "\output.txt"

Local $array[1]
_FileReadToArray($file, $array)
$hOutput = FileOpen($file_output, 2)
$iMultiplier = 3
Global $aTemp, $Text
For $i = 1 To $array[0]
    $aTemp = StringSplit($array[$i], @TAB)
    If Not Mod($i, 50) Then $iMultiplier += 1
    $text = ""
    For $j = 1 To $aTemp[0]
        $text &= $aTemp[$j] * $iMultiplier & @TAB
    Next
    $text = StringTrimRight($text, 1)
    FileWriteLine($hOutput, $text)
Next

FileClose($hOutput)

 

ylcag.png

Share this post


Link to post
Share on other sites



@vin1 in the future, do not hijack other people's threads, please.

As to your code, do an _ArrayDisplay on your array after the _FileReadToArray call. Is the value for $array[0] what you expect it to be?


When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

Îs the path assigned to $file correct? If yes can you please attach the file, if no correct it and test again.

Share this post


Link to post
Share on other sites

What if your input file (temp.txt) has no data ?

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
Sign in to follow this  
Followers 0