Sign in to follow this  
Followers 0
doomkiller

reading from a txt file

3 posts in this topic

#1 ·  Posted (edited)

I nedd to be able to have my script go through a text that has a setup like this

server1

server2

server3

and plug in each one in the box i tell it to using the

Send()

command or a simliar command and then log what happens after each one. How would i got about doing this.

any help is greatly appreciated.

Edited by doomkiller

Share this post


Link to post
Share on other sites



I would start with FileRead() and FileReadLine()

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I would start with FileRead() and FileReadLine()

<{POST_SNAPBACK}>

I'd actually read the file into an array first then manipulate, It's much faster if you do it this way. Here is an example of how I would do it. I didn't add any error checking, but you would want to.

I didn't understand your send question for the server though.

; ----------------------------------------------------------------------------
;
; AutoIt Version: 3.1.0
; Author:         Kerberuz
;
; Script Function:
;    Read from file, create combobox
;
; ----------------------------------------------------------------------------

; Script Start - Add your code below here
#include <File.au3>
#include <GUIConstants.au3>
Dim $aFile
$i = 1
_FileReadToArray ( "Filetoread.txt", $aFile )

GUICreate("Read from file, then create a combobox"); will create a dialog box that when displayed is centered

GUICtrlCreateCombo (StringReplace($aFile[1], @CR, ""), 10,10); create first item
Do
    $aFile[$i] = StringReplace($aFile[$i], @CR, "")
    GUICtrlSetData(-1, $aFile[$i]); add new items that were read from file
   $i = $i + 1
Until $i = $aFile[0] + 1

GUISetState ()

; Run the GUI until the dialog is closed
While 1
    $msg = GUIGetMsg()
    
    If $msg = $GUI_EVENT_CLOSE Then ExitLoop
Wend

Filetoread.txt

Edited by Kerberuz

Kerby

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