NothingLeft Posted July 12, 2008 Share Posted July 12, 2008 (edited) Hello all, I'm brand new to AutoIt but looks like it will be very useful indeed. I have a DOS batch script that I use to generate a text file containing: var1=value1 var2=value2 var3=value3 I'd like to auto fill a web form with known field names, which I could match to the batch output file. AutoIt would parse the .txt, set vars and values using = as the separator, then fill the form using vars matched to form field names. SET field1=value1 SET field1=value2 etc It would also need to do something like: SET textbox1=value4[newline]value5[newline]value6[newline] etc. Is there some example code to get me started? Looks like Firefox isn't as well supported as IE but either will do for now. thanks, NL Edited July 12, 2008 by NothingLeft Link to comment Share on other sites More sharing options...
PsaltyDS Posted July 12, 2008 Share Posted July 12, 2008 Hello all, I'm brand new to AutoIt but looks like it will be very useful indeed. Welcome to AutoIt. muttley I have a DOS batch script that I use to generate a text file containing: var1=value1 var2=value2 var3=value3 I'd like to auto fill a web form with known field names, which I could match to the batch output file. AutoIt would parse the .txt, set vars and values using = as the separator, then fill the form using vars matched to form field names. SET field1=value1 SET field1=value2 etc Read the file into an array with _FileReadToArray(), then go through each line with a For/Next loop. For each line, split it at the "=" with StringSplit(). Look into the _IE* functions of the IE.au3 UDF for things like _IEFormElementGetObjByName() and _IEFormElementSetValue(). All of those functions are listed in the help file, with example scripts. It would also need to do something like: SET textbox1=value4[newline]value5[newline]value6[newline] etc. Is there some example code to get me started? Looks like Firefox isn't as well supported as IE but either will do for now. thanks, NL AutoIt's operator for concatenating strings is "&" and there are defined macros like @CRLF for newline. So that would look something like this: $sTextBox1 = "value4" & @CRLF & "value5" & @CRLF & "value6" & @CRLF "Set" is not required for variable assignment. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law Link to comment Share on other sites More sharing options...
NothingLeft Posted July 13, 2008 Author Share Posted July 13, 2008 Thanks for the reply, PsaltyDS, very helpful. Looks like I could use IniRead and/or IniReadSection to parse my text file if I got the DOS batch to structure it that way (it's not that far off already) Will experiment a bit and post back with progress. thanks, NL 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