Jump to content
Sign in to follow this  
Leoj

[Need Help] Need to shorten script!

Recommended Posts

Leoj

Very first text in my au3 file:

$file1 = FileOpen("myservers.txt", 0)
            $i = 0
        Do
            $Server1 = FileReadLine($file1, 1)
                If $Server1 == "" Then 
                    $Server1 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
            $i = 0
        Do
            $Server2 = FileReadLine($file1, 2)
                If $Server2 == "" Then 
                    $Server2 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
            $i = 0
        Dro
            $Server3 = FileReadLine($file1, 3)
                If $Server3 == "" Then 
                    $Server3 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
            $i = 0
        Do
            $Server4 = FileReadLine($file1, 4)
                If $Server4 == "" Then 
                    $Server4 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
            $i = 0
        Do
            $Server5 = FileReadLine($file1, 5)
                If $Server5 == "" Then 
                    $Server5 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
            $i = 0
        Do
            $Server6 = FileReadLine($file1, 6)
                If $Server6 == "" Then 
                    $Server6 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
            $i = 0
        Do
            $Server7 = FileReadLine($file1, 7)
                If $Server7 == "" Then 
                    $Server7 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
            $i = 0
        Do
            $Server8 = FileReadLine($file1, 8)
                If $Server8 == "" Then 
                    $Server8 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
            $i = 0
        Do
            $Server9 = FileReadLine($file1, 9)
                If $Server9 == "" Then 
                    $Server9 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
            $i = 0
        Do
            $Server10 = FileReadLine($file1, 10)
                If $Server10 == "" Then 
                    $Server10 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
            $i = 0
        Do
            $Server11 = FileReadLine($file1, 11)
                If $Server11 == "" Then 
                    $Server11 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
            $i = 0
        Do
            $Server12 = FileReadLine($file1, 12)
                If $Server12 == "" Then 
                    $Server12 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
            $i = 0
        Do
            $Server13 = FileReadLine($file1, 13)
                If $Server13 == "" Then 
                    $Server13 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                $i = 0
        Do
            $Server14 = FileReadLine($file1, 14)
                If $Server14 == "" Then 
                    $Server14 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                $i = 0
        Do
            $Server15 = FileReadLine($file1, 15)
                If $Server15 == "" Then 
                    $Server15 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                $i = 0
        Do
            $Server16 = FileReadLine($file1, 16)
                If $Server16 == "" Then 
                    $Server16 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                $i = 0
        Do
            $Server17 = FileReadLine($file1, 17)
                If $Server17 == "" Then 
                    $Server17 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server18 = FileReadLine($file1, 18)
                If $Server18 == "" Then 
                    $Server18 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server19 = FileReadLine($file1, 19)
                If $Server19 == "" Then 
                    $Server19 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server20 = FileReadLine($file1, 20)
                If $Server20 == "" Then 
                    $Server20 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server21 = FileReadLine($file1, 21)
                If $Server21 == "" Then 
                    $Server21 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server22 = FileReadLine($file1, 22)
                If $Server22 == "" Then 
                    $Server22 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server23 = FileReadLine($file1, 23)
                If $Server23 == "" Then 
                    $Server23 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server24 = FileReadLine($file1, 24)
                If $Server24 == "" Then 
                    $Server24 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server25 = FileReadLine($file1, 25)
                If $Server25 == "" Then 
                    $Server25 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server26 = FileReadLine($file1, 26)
                If $Server26 == "" Then 
                    $Server26 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server27 = FileReadLine($file1, 27)
                If $Server27 == "" Then 
                    $Server27 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server28 = FileReadLine($file1, 28)
                If $Server28 == "" Then 
                    $Server28 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server29 = FileReadLine($file1, 29)
                If $Server29 == "" Then 
                    $Server29 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server30 = FileReadLine($file1, 30)
                If $Server30 == "" Then 
                    $Server30 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server31 = FileReadLine($file1, 31)
                If $Server31 == "" Then 
                    $Server31 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server32 = FileReadLine($file1, 32)
                If $Server32 == "" Then 
                    $Server32 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server33 = FileReadLine($file1, 33)
                If $Server33 == "" Then 
                    $Server33 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server34 = FileReadLine($file1, 34)
                If $Server34 == "" Then 
                    $Server34 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
                        $i = 0
        Do
            $Server35 = FileReadLine($file1, 35)
                If $Server35 == "" Then 
                    $Server35 = ""
                EndIf
            $i = $i + 1
        Until $i = 1
FileClose($file1)oÝ÷ Ù8b²+jY^vêh¼®«¢FP®¶­sbb33c´Æõ6W'fW'2ÒuT7G&Ä7&VFTÆ7BgV÷C·FW7Bç6W'fW#ææWB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DFFÓÂb33cµ6W'fW#3"¤uT7G&Å6WDFFÓÂb33cµ6W'fW#32¤uT7G&Å6WDFFÓÂb33cµ6W'fW#3B¤uT7G&Å6WDFFÓÂb33cµ6W'fW#3RoÝ÷ Úȳz쥩ì·)^

myservers.txt is the default text file but I have an option in the GUI which lets a user specify their own text file. I need "myserver.txt to be a variable (from the GUI) but... this whole bit of script must come BEFORE the GUI! dammit!

Much help needed and any appreciated.

Edited by Leoj

Share this post


Link to post
Share on other sites
enaiman

Ok

1. your first block of code can be written:

$file1 = FileOpen("myservers.txt", 0)
Dim $server[51]
For $x = 1 to 50            ;the For-Next loop is doing a great job at this things
      $server[$x] = FileReadLine($file1, $x)
Next
FileClose($file1)

is an example but better take a look in the help file to learn more.

And an ini file can be used also (look at IniRead and IniWrite in the help)


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

Share this post


Link to post
Share on other sites
Leoj

Thank you very much. I hope something nice happens to you in the next couple of days! Because that is so much shorter... haha!

well, my program is comming right a long now, thanks.

Share this post


Link to post
Share on other sites
enaiman

You're welcome :) Glad it worked.

I hope something nice happens to you in the next couple of days!

hehe ... a little luck can't hurt :D


SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script

wannabe "Unbeatable" Tic-Tac-Toe

Paper-Scissor-Rock ... try to beat it anyway :)

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.