Jump to content
Sign in to follow this  

Stuck in an Do or If loop

Recommended Posts

This was supposed to be a quick and dirty program to complete a one off project. It hasn't been quick.

I have a list of vessel names. These vessel have brought our software and we need to make sure that they are offered an upgrade to a regulatory module we sell.

The program should.

1) Get the name of the vessel from a file on the local machine.

2) Loop through a file text file (purchased.txt) until to comes to the last entry, searching for the word Dealer.

3) Add the vessel and Dealer name to a third file

4) Close the vessel's text file.

5) Start over again at 1 from the next vessel

This works splendidly for the first vessel on the list. However, it seems to get stuck in the Do loop. The information never gets written to file and first purchased.txt file never gets closed.

Is "until @error=-1" valid?

While 1
    $VesselPath=$customerdatalocation & $VesselName &"\Purchased.txt"
    ;Loop until you reach the end of the File
    GUICtrlSetData ( $Label1 , $Vesselpath)
        if $Whoisthedeal<> 0 Then
            msgbox(1,$Whoisthedeal, $Thestatus)
    until @error=-1
    msgbox(1,"2", $Thedealer)
    $Whatthefuck=FileWrite($Vesselwithdealer,$VesselName&" "& $Thedealer)

Share this post

Link to post
Share on other sites

@error is a value used by all autoit functions. Anytime you call any autoit function, @error is reset to 0. If your are looking to see if filereadline() has set @error to -1, it must be checked directly after the call.

if @error = -1 then exitloop

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