Sign in to follow this  
Followers 0
muhmuuh

Vista issues

5 posts in this topic

Hello, autoiters!

I've created an autoit program for one guy. I'm using WinXp and the program works perfectly but he uses Vista and it seems that there are some problems. I don't have access to a Vista computer so the testing gets really slow as I have to send him the program, he tries to describe the problem, I sent another version... So after few tests I think the problem part is where I read a txt file:

$f = FileOpen("file.txt", 0)
$bu = 0
Global $lg[100000]
While 1
 $l = FileReadLine($f)
 If @error = -1 Then ExitLoop
 $bu += 1
 $lg[$bu] = $l
WEnd

It gives the infamous error

Array variable has incorrect number of subscripts or subscript dimension range exceeded

My guess is that @error never gets to -1 and $bu gets larger than $lg's size but I hope you will tell me that :(

I remember there was a topic explaining some Vista issues but I can't find it. I really like the new look of the forum but I hate the search. It didn't help me at all >_<

So, what can cause the error in my case? What are other known issues about AutoIt under vista?

Any comments will be appreciated. Thank you for your time

p.s. Sorry for my English. I'm not a native speaker and I'm still learning it. Correct me if I've made mistakes.


I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.

Share this post


Link to post
Share on other sites



Run this, see what you get:

$f = FileOpen("file.txt", 0)
$bu = 0
Global $lg[100000]

While 1
    $l = FileReadLine($f)
    If @error = -1 Then ExitLoop
    If $bu = UBound($lg) - 1 Then
        MsgBox(64, "Aha!", "The problem is that the array is too small.")
        ExitLoop
    EndIf
    $bu += 1
    $lg[$bu] = $l
WEnd

♡♡♡

.

eMyvnE

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Run this, see what you get:

$f = FileOpen("file.txt", 0)
$bu = 0
Global $lg[100000]

While 1
    $l = FileReadLine($f)
    If @error = -1 Then ExitLoop
    If $bu = UBound($lg) - 1 Then
        MsgBox(64, "Aha!", "The problem is that the array is too small.")
        ExitLoop
    EndIf
    $bu += 1
    $lg[$bu] = $l
WEnd

Already thought about that, but with the tiny difference to display $bu but as I said I can't test it as I don't have access to a vista computer. Can someone with vista put few lines in file.txt and try this for me? I would be very thankful

Also what other Vista issues can appear with AutoIt?

Edited by muhmuuh

I ran. I ran until my muscles burned and my veins pumped battery acid. Then I ran some more.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$f = FileOpen("file.txt", 0)
$bu = 0
Global $lg[100000]

While 1
    $l = FileReadLine($f)
    If @error = -1 Then ExitLoop
    If $bu = UBound($lg) - 1 Then
        MsgBox(64, "Aha!", "The problem is that the array is too small.")
        ExitLoop
    EndIf
    $bu += 1
    $lg[$bu] = $l
WEnd

Tested under Vista, - it works.

Edited by Vitas

_____________________________________________________________________________

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Ok, tell me, is this works under WinXp?

#include <Constants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>

Global $str[20], $trimmed = 0, $alltrimmed = 0, $stout = ""
$Form1 = GUICreate("Form1", 321, 70, 355, 477)
$Label1 = GUICtrlCreateLabel("Received bytes", 8, 24, 117, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$Input1 = GUICtrlCreateInput("0", 154, 24, 153, 21, BitOR($ES_AUTOHSCROLL,$ES_READONLY))
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)

While 1
    Sleep(1000)
    $cmd = Run(@comspec & " /c netstat -e", @SystemDir, @SW_HIDE,  $STDIN_CHILD & $STDOUT_CHILD)
    Sleep(1000)
    $line = StdoutRead($cmd)
    ;getting from STDOUT only number of received bytes and update control whith this info:
    $str = StringSplit($line,@CR)
    For $i = 1 to $str[0]-1 Step 2
        If $str[$i] <> "" And $i = 5 Then
            $strn = StringSplit($str[$i],"")
            $string = $str[$i]
            For $n = 1 to $strn[0] Step 1
                If StringIsDigit($strn[$n]) And $trimmed = 0 Then
                    $alltrimmed = 1
                    $stout = $stout & $strn[$n]
                ElseIf Not StringIsDigit($strn[$n]) And $alltrimmed = 1 Then
                    $trimmed = 1
                EndIf
            Next
                GUICtrlSetData($Input1, $stout)
                $stout = ""
                $trimmed = 0
                $alltrimmed = 0

        EndIf
    Next
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd
Edited by Vitas

_____________________________________________________________________________

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