Jump to content

Problems with the search window


jurco
 Share

Recommended Posts

Friends:

I have a new problem.

by the way, I had already checked the "Huge Timing Problems" topic posted by 83bj60, It gave me some good tips, but not the solution until now.

I am using the search tool at wordpad looking in a big text (300 pages) for some key words.

The main idea is that the program has to find the word, copy the complete line of the word to other wordpad window, and goes to the next word that matches.

The idea is that the program will be able to check several key words on the text, but that will be a next step, for now, I am pulling in the word to search with an input box.

Where is the problem?

Ok, I open the search box (^f), send the word to be find, and the program works perfecty until a second window telling me that the search is finished appears.

The main idea is that when this finish box appears, the program should return the the input box, to type the next word to find.

Returning to the main problem, when you ask the find box to find a word, as I can see, the only change is the shape of the mouse, and when it stops, the text on the main wordpad window is selected.

In order to make AutoIt understands when the search is finished, I have tried with mousegetcursor, winwaitactive the finishbox, winwaitnotactive the searchbox, and seems that none of these are stables, some times it works, some times not, and 90% of the times it makes the mistake is because any match was found.

As a matter of facts, I had used the spy the check the active window and when the search is finished, the spy recognize that a new window appers. To check this, I inserted a msgbox with wingettitle just to be sure, and when running the script, the wingettitle gets the name of the searchbox, and not the name of the finishbox.

I am attaching the script, sorry is in spanish, but I am sure you will understand it.

Other two questions:

Is there any inputbox for dates?

Is it possible to make this program runs in a hidden mode, and I can use the computer in other tasks while the program runs itself, and just let you know he had finished?

Thanks for all your help.

Jurco.

$titarchivo = ("08-25-04 - WordPad");TEMPORAL

$carnada1=1

$carnada2=1

;msgbox (0,"","ID = " & $titarchivo)

;ABRIENDO DIALOGO DE BUSQUEDA

do

$busqueda = inputbox ("Texto a buscar", "escribe el texto a buscar o TERMINAR")

if $busqueda=("TERMINAR") then exitloop

WinActivate("Documento - WordPad")

WinWaitActive("Documento - WordPad")

send ("{enter}")

send ("^n")

send ($busqueda)

send ("^n")

send ("{enter}")

WinActivate($titarchivo)

WinWaitActive($titarchivo)

send ("^{HOME}")

send ("^b")

WinWaitActive("Buscar")

send ($busqueda)

; HACIENDO LA BÚSQUEDA

do

send ("!s")

Do

$mouse = MouseGetCursor ()

;msgbox (0,"","ID = " & $mouse)

sleep (1000)

Until $mouse = 2

sleep (1000)

$subtitulo = wingettitle ("")

msgbox (0,"","titwin = " & $subtitulo)

if $subtitulo = "WordPad" then exitloop

;if winactive("WordPad") then exitloop

;If winwaitnotactive ("Buscar") Then ExitLoop

WinActivate($titarchivo)

WinWaitActive($titarchivo)

send ("{home}")

send ("+{down}")

send ("^c")

WinActivate("Documento - WordPad")

WinWaitActive("Documento - WordPad")

send ("^v")

WinActivate($titarchivo)

WinWaitActive($titarchivo)

send ("{down}")

WinActivate("Buscar")

WinWaitActive("Buscar")

until $carnada2=8

winwaitactive("WordPad")

sleep (1000)

send ("{ESC}")

WinActivate("Buscar")

WinWaitActive("Buscar")

send ("{ESC}")

until $carnada1=10

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