Hi all,
Apologies for my noobiness, i do appreciate your help!
I am trying to read line 1 of a notepad, associate it with a variable, then sending that variable elsewhere.
then do the same for line 2 and so on and so on until there are no more lines in the notepad.
I need to collect two IP address, first the user will enter in the GUI box, the second will be line 1 in the notepad
Then use the same first ip adress (as first entered in GUI box) and then use line 2 in the notepad.
I have started a new notepad at the end just to test that it is getting these values, later on i will put it in the appropriate program.
Thanks for your help
Tim
AutoIt
#include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Template IP for PLID copy", 436, 160, 192, 124) $Input1 = GUICtrlCreateInput("Ip address", 144, 48, 153, 21) $Label1 = GUICtrlCreateLabel("What is the Template IP?", 72, 16, 292, 17) $Button1 = GUICtrlCreateButton("Ok", 80, 96, 113, 25) $Button2 = GUICtrlCreateButton("Cancel", 240, 96, 105, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $Button1 $IP = GUICtrlRead($Input1) ExitLoop case $Button2 Exit Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Local $file = FileOpen("D:\userdata\testdir\txt.txt", 0) ; Check if file opened for reading OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in lines of text until the EOF is reached While 1 Local $line1 = FileReadLine($file, 1) $line2 = FileReadLine($file, 2) $line3 = FileReadLine($file, 3) $line4 = FileReadLine($file, 4) $line5 = FileReadLine($file, 5) If @error = -1 Then ExitLoop WEnd FileClose($file) Run("notepad.exe") WinWaitActive("Untitled - Notepad") Send($IP) Send("{ENTER}") Send($line1)