Jump to content
Sign in to follow this  
Andre

Array Error ?

Recommended Posts

Hi this is working

Dim $aRecords
If Not _FileReadToArray("c:\tmp\a\test.ovpn",$aRecords) Then
   MsgBox(4096,"Error", " Error reading log to Array     error:" & @error)
   Exit
EndIf
For $x = 1 to $aRecords[0]
    Msgbox(0,'Record:' & $x, $aRecords[$x])
Next

This not :

Func Modify_ConfigFile()
    Dim $ConfigFile_Array
    
    FileInstall('c:\download\openvpn\openvpn.ovpn', $DefInstallDir & '\config\',1)
    _FileReadToArray($DefInstallDir & '\config\' &$ConfigFile, $ConfigFile_Array)
    $FileHandle = FileOpen($DefInstallDir & '\config\' & $ConfigFile,2)
    For $x = 1 To $ConfigFile_Array[0]
        If StringInStr($ConfigFile_Array[$x],'ovpnxxxx_crt.pem') Then
            $ConfigFile_Array[$x] = 'cert ' & $Crt_File
        ElseIf StringInStr($ConfigFile_Array[$x],'ovpnxxxx_key.pem') Then
            $ConfigFile_Array[$x] = 'key ' & $Key_File
        EndIf
        $ConfigFile_Array[$x] = StringStripCR($ConfigFile_Array[$x])
        FileWriteLine($FileHandle, $ConfigFile_Array[$x])
    Next
    FileClose($FileHandle)
EndFunc

Error : ==> Subscript used with non-Array variable.:

For $x = 1 To $ConfigFile_Array[0]

For $x = 1 To $ConfigFile_Array^ ERROR

Can't find the error :lmao:

Andre

Edit : Can't remember having this error in the beta

Edited by Andre

What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!

Share this post


Link to post
Share on other sites

Yes,

Seems that _FileReadToArray($DefInstallDir & '\config\' &$ConfigFile, $ConfigFile_Array) won't work because the file is not there ;(

Dumb Andre


What about Windows without using AutoIt ?It would be the same as driving a car without an steering Wheel!

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...