pix Posted August 23, 2015 Share Posted August 23, 2015 Hello Guys,I have a code that reads the Text file contents line by line and send key stroke to an online application. I want to automate this further so that it can read multiple files with same content structure and send keystrokes to my online application.Below are my specs and existing code for 1 fileExisting Script that reads 1 file and send Keystrokes to 1 page:;This code reads the text file line by line ;stores the lines of data into array ;sends the array data to Browser #include <Array.au3> #include <File.au3> Local $aInput $file = @ScriptDir & "\Run Me.txt" _FileReadToArray($file, $aInput) WinWaitActive("Portal - Mozilla Firefox") For $i = 1 to UBound($aInput) -1 Send($aInput[$i],1) Send("{TAB}") NextText File (Run Me.txt) Content Structure:Line01Line02Line03Line04Line05Line06Line07Line08Line09Line10Line11Line12Line13Line14Line15Line16Line17Line18Line19Line20 NOWI have 100 such files named with numbers (01.txt, 02.txt, 03.txt, ... , 97.txt, 98.txt, 99.txt, 100.txt) into one folder. All of these files have just 20 Lines with no blank lines in between.I have my online application that I can open through Firefox. This online application have 20 Text Boxes, 1 Dropdown List and 1 Submit Button.I want to fetch 20 Lines of file 01.txt, Send 20 Lines to 20 Textboxes of that online application via KEYSTROKES such that Line1 text is sent to Textbox1, Line2 text is sent to Textbox2 and so on.After filling all 20 Text Boxes, I want to press Submit Button. After a delay of 15 Seconds, I should select the another page from Dropdown List, I should select the another file - 02.txt and repeat the same process.This should be looped to fetch data from all 100 text files one by one, sending the keystrokes to each respective page, submitting after completion and selecting the next page.Please note that: Sending the Textlines to Textboxes, I can only use the Keystrokes and not the Clipboard CAN ANYBODY PLEASE HELP ME OUT TO MODIFY MY ABOVE WRITTEN CODE TO EXTEND IT TO INCLUDE THE ABOVE FUNCTIONALITYANY DAMN HELP WILL BE USEFULTHANK IN ADVANCE Link to comment Share on other sites More sharing options...
JohnOne Posted August 23, 2015 Share Posted August 23, 2015 Look at FileListToArray and put all of your code in a loop through the array it creates. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
Surya Posted August 23, 2015 Share Posted August 23, 2015 Put your code through a for loop so that each of your file is read I will give you the code soon No matter whatever the challenge maybe control on the outcome its on you its always have been. MY UDF: Transpond UDF (Sent vriables to Programs) , Utter UDF (Speech Recognition) Link to comment Share on other sites More sharing options...
Surya Posted August 23, 2015 Share Posted August 23, 2015 Here is the code:;This code reads the text file line by line ;stores the lines of data into array ;sends the array data to Browser #include <Array.au3> #include <File.au3> progresson("Sending Started","starting") for $k = 0 to 100 progressset($k) Local $aInput $file = @ScriptDir & "\" &$k &".txt" _FileReadToArray($file, $aInput) WinWaitActive("Portal - Mozilla Firefox") For $i = 1 to UBound($aInput) -1 Send($aInput[$i],1) Send("{TAB}") Next sleep(15000) next progressoff() msgbox("","","All data entry finished")I just added the loop and progressbar for your convienience here its your code and if you want to increase precision use control send instead of simple send hope i helped you if you want anymore help feel free to ask No matter whatever the challenge maybe control on the outcome its on you its always have been. MY UDF: Transpond UDF (Sent vriables to Programs) , Utter UDF (Speech Recognition) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now