WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

How To
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Open File Search from StartMenu


Question:

Please take a look at my code below and help me to fix it. I try to open search from File/Start Menu/Search by using sendkeysTo and sendMenuTo and it didn't work. It didn't open Search window.
GoSub StartExplorer
while @TRUE
;Open the Explorer "Go to" window
while @TRUE
SendKeysTo( wExpId,"{ALT} F")
TimeDelay( DebugWait )
SendMenusTo( wExpId,"Start Menu Search") 
TimeDelay( deBugWait )
waitStat = WinWaitExist( "Search Results") , 5 ) ; ;Examine the wait exit status
if waitStat
wGotoId = WinIdGet( "Search Results" ) 
break
else
TimeDelay( DebugWait + copyDirWait )
endif
endwhile 
I am running windows 2000.

Answer:

I urge you to look at more reliable alternatives to the SendKeys/SendMenus functions--WinBatch has a Searcher Extender that will probably do what you need and will be easier to script. There is also the OLE method of controlling the Shell.Application object:
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;Launch Find Files dialog
Shell=ObjectOpen ("Shell.Application")
Shell.FindFiles
ObjectClose (Shell)
Exit
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Or if you are dead set against adding additional dll's to your script, here's a Windows API call:
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;Launch Find Files dialog
Shell32=StrCat (DirWindows(1),"shell32.dll")
RetVal=DllCall (Shell32,Long:"ShellExecuteA",lpnull,lpstr:"find",lpstr:"C:\test",lpnull,lpnull,long:0)
Exit
;~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Article ID:   W15994
File Created: 2004:03:30:15:42:08
Last Updated: 2004:03:30:15:42:08