mark30 Posted June 20, 2006 Share Posted June 20, 2006 Hi,Does anybody know how to do the following, if would save me around 2 or 3 hours work per day so your help would be very appreciated. With reference to the sample text below, i'm am required to enter the data from below into a database manually. I receive the txt file each morning then have the mind numbing task of entering each line into another database.I start from the oldest date (below would be 06/19/06 22:14) then enter the 'checked', 'Passed', and 'Verified' data into the different database!For example if i was entering data for '06/19/06 22:14' i would open up the database then click Q then 1 then Q then 5 then Q then 5 and click ok. Then move up to the next line and start again. Time Checked Passed Verified06/19/06 22:21 P2 P1 Y406/19/06 22:20 P3 P5 I806/19/06 22:20 P2 P5 Y206/19/06 22:19 L1 L4 I406/19/06 22:18 P2 P3 Y406/19/06 22:18 P2 P3 Y406/19/06 22:17 P2 P3 Y406/19/06 22:16 T4 T3 T406/19/06 22:15 W1 W1 W506/19/06 22:15 P1 P4 P606/19/06 22:14 P2 P3 R206/19/06 22:14 Q1 Q5 Q5 I know i can use the mouseclick command and coordinates to simulate the clicks in the database but i'm not sure how to get autoit to look through the text doc.Regards,Mark. Link to comment Share on other sites More sharing options...
BuddyBoy Posted June 20, 2006 Share Posted June 20, 2006 Use WinGetText, if thats what your looking for... Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 20, 2006 Moderators Share Posted June 20, 2006 (edited) Use WinGetText, if thats what your looking for...What does WinGetText have to do with his request ?Edit:What Database are you using? Edited June 20, 2006 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
BuddyBoy Posted June 20, 2006 Share Posted June 20, 2006 i'm not sure how to get autoit to look through the text doc.Thats his words, and if thats not exactly what he means then im wrong lol... Link to comment Share on other sites More sharing options...
Uten Posted June 20, 2006 Share Posted June 20, 2006 Hi and welcome This is a typical AutoIt job.Install Autoit, Autoit beta and Scite4Autoit3.Open the help file and do the tutorials and make yourselfe aquinted with it (in your case FileRead() is a must .Then make some code and post your code and question if you encounter problems.Wish you luck. Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted June 20, 2006 Moderators Share Posted June 20, 2006 Thats his words, and if thats not exactly what he means then im wrong lol..."text doc" is not the same as "window text" Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. Link to comment Share on other sites More sharing options...
mark30 Posted June 20, 2006 Author Share Posted June 20, 2006 Thanks for the info. I have been looking up 'FileRead' and also 'WinGettext', which i understand how to use but how can i tell it to read line by line. Another idea is to copy the text data into ms excel and use the cell numbers not sure if that will work though. Sm0ke_N - the database is written in Oracle (SQL Database) I think. But everything is getting upgraded over the next few weeks so a bit of manual work is required. Cheers. Link to comment Share on other sites More sharing options...
cowsmanaut Posted June 20, 2006 Share Posted June 20, 2006 it's definitely FileRead you want.. you want to read in the lines by defining what line to read. a snippet of code here I was using.. there is this same stuff in the help file. open the file, read a specific line, close it. ;open the file $file = FileOpen("c:/ip.txt", 0) ; Check if file opened for reading OK or exit If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf ; Read in line34 $chara = FileReadLine($file, 34) FileClose($file) You could then use arrays probably to extract the specifics you wanted? just a guess. For me I just needed the lines of text in the Ip.txt for reading back to the user.. In the help file it reads line after line for you and sends it to a message box.. so you could use that loop to read one line at a time and then use the coresponding info in order to extract the information you wanted and input it into the database and then when it reads end of file.. exit. not sure if that helps at all.. and since it's taken me an hour to hit send on this post, someone may have already beaten me to it so sorry if this info is redundant dang MSN... and Phone.. and people talking at me.. sheesh Link to comment Share on other sites More sharing options...
Uten Posted June 21, 2006 Share Posted June 21, 2006 (edited) I have been looking up 'FileRead' and also 'WinGettext', which i understand how to use but how can i tell it to read line by line. Another idea is to copy the text data into ms excel and use the cell numbers not sure if that will work though.In the help page for FileRead there is also a link to a handy dandy function called FileReadLine. So some quick and dirty code would be (from the top of my head). $file = FileOpen("data.dat", 1);1 for read access if I recall right While 1 $data = FIleReadLine($file) if @error <> 0 Then ExitLoop;Probably -1 you get it at EOF or other error $arr = StringSplitt($file, @TAB) ; You might want to set focus to the entry dialog here. Use au3Record app to figure out how. ;Figure out controlID and windowtitle with the au3info tool. ControlSend("TODO: windowtitle", "", "TODO: controlID-1", $arr[1]) ControlSend("TODO: windowtitle", "", "TODO: controlID-2", $arr[2]) ControlSend("TODO: windowtitle", "", "TODO: controlID-3", $arr[3]) ControlSend("TODO: windowtitle", "", "TODO: controlID-4", $arr[4]) ControlSend("TODO: windowtitle", "", "TODO: controlID-4", "{ENTER}");hit the OK button WEnd FileClose($file) Something like that Edited June 21, 2006 by Uten Please keep your sig. small! Use the help file. Search the forum. Then ask unresolved questions :) Script plugin demo, Simple Trace udf, TrayMenuEx udf, IOChatter demo, freebasic multithreaded dll sample, PostMessage, Aspell, Code profiling 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