Jump to content
Sign in to follow this  

reading from a txt file

Recommended Posts

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




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


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()


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


Edited by Kerberuz


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