Jump to content

Want to extent My Code


pix
 Share

Recommended Posts

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 file

Existing 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}")
Next

Text File (Run Me.txt) Content Structure:

Line01
Line02
Line03
Line04
Line05
Line06
Line07
Line08
Line09
Line10
Line11
Line12
Line13
Line14
Line15
Line16
Line17
Line18
Line19
Line20

 

NOW

I 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 FUNCTIONALITY

ANY DAMN HELP WILL BE USEFUL

THANK IN ADVANCE

 

Link to comment
Share on other sites

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

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...