Jump to content
Macro Express Forums

How To Sense When Windows Search Has Finished?


David Tong

Recommended Posts

Every few days I run a macro that:

 

(1) Finds all doc files in My Documents (about 2000 in all) using the Windows Search window.

(2) Selects everything in the results window and drags them into a pre-opened Powermarks window.

 

This triggers Powermarks to make a link to each document, with each word in the filename stored as a keyword with the link. The result is that I can use Powermarks to retrieve any document instantly just by typing in the first few letters of one or more keywords.

 

Most of the time Windows Search takes only a few seconds, but sometimes it can take nearly a minute. So it would be nice if the macro could sense when Search has finished. The trouble is, I can’t see how to achieve this and instead I have to insert a crude worst-case wait of about 45 seconds.

 

I tried ‘Get Control %C1%’ on the search output window followed by ‘Wait for Control %C1% to become enabled’ but this has no effect. And ‘Wait for program to terminate’ seems inappropriate because Windows Search isn’t listed as a program.

 

Can anyone suggest a way of detecting the end of a search automatically?

 

Thanks,

David Tong.

Link to comment
Share on other sites

One simple solution is to use the Get Pixel Color command. The Windows Explorer Search dialog has two buttons, Search Now and Stop Search. You can use this command to trap a pixel color at some point on the Search Now button, do the search, and then wait until the button is restored to its original color. This will work because the button is disabled during the search and is re-enabled afterwards. The steps:

  • Move mouse over a point on the Search Now button
  • Get Pixel Color at that position
  • Use the Mouse Left Button Click command to start the search
  • Inside an infinite loop ...
  • Delay for a second or two
  • Get the pixel color again
  • ... continue looping until the color is correct
  • Exit the loop

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...