Jump to content

Anyone know how to do this?


Recommended Posts

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. :D

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 Verified

06/19/06 22:21 P2 P1 Y4

06/19/06 22:20 P3 P5 I8

06/19/06 22:20 P2 P5 Y2

06/19/06 22:19 L1 L4 I4

06/19/06 22:18 P2 P3 Y4

06/19/06 22:18 P2 P3 Y4

06/19/06 22:17 P2 P3 Y4

06/19/06 22:16 T4 T3 T4

06/19/06 22:15 W1 W1 W5

06/19/06 22:15 P1 P4 P6

06/19/06 22:14 P2 P3 R2

06/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

  • Moderators

Use WinGetText, if thats what your looking for...

What does WinGetText have to do with his request :D ?

Edit:

What Database are you using?

Edited 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

Hi and welcome :D

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 :D.

Then make some code and post your code and question if you encounter problems.

Wish you luck.

Link to comment
Share on other sites

  • Moderators

Thats his words, and if thats not exactly what he means then im wrong lol...

"text doc" is not the same as "window text" :D

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

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

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 :D dang MSN... and Phone.. and people talking at me.. sheesh :D

Link to comment
Share on other sites

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 :D

Edited by Uten
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...