![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks. |
| |||||||
![]() |
| |
| | #1 (permalink) |
| | Re: automation of Windows Explorer search window Marceepoo wrote: Quote: > The vbscript below opens a Windows Explorer search window. > The Windows Explorer search window has fields in which the user can insert Quote: > search String Filter, and a search path String. > I can't figure out what code to use to insert: > 1. A search filter string in the field entitled "All or part of the Quote: > name"; Or > 2. A search path string in the field entitled: "Look in:" > > I tried using Sendkeys, > (Alt-L = "Lookin in:" field) > (Alt-O = Filename/filemask field, "All or part of the file name:") > (Alt-R = "Search" button) > But Sendkeys doesn't seem to trigger any action at all in the search Quote: > > Any suggestions would be much appreciated. > > Marceepoo > > Dim objShell > Set objShell = WScript.CreateObject("Shell.Application") > objShell.FindFiles Dim objShell, WshShell Set objShell = WScript.CreateObject("Shell.Application") set WshShell = WScript.CreateObject("WScript.Shell") objShell.FindFiles WScript.Sleep 500 WshShell.AppActivate "Find: All files" WScript.Sleep 500 WshShell.SendKeys "foo{tab}bar{tab}" WScript.Sleep 500 WshShell.SendKeys "c:\windows{enter}" -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages) |
My System Specs![]() |
| | #2 (permalink) |
| | Re: automation of Windows Explorer search window On May 28, 11:09 pm, "Todd Vargo" <tlva...@xxxxxx> wrote: Quote: > Marceepoo wrote: Quote: > > The vbscript below opens a Windows Explorer search window. > > The Windows Explorer search window has fields in which the user can insert Quote: > > search String Filter, and a search path String. > > I can't figure out what code to use to insert: > > 1. A search filter string in the field entitled "All or part of the Quote: > > name"; Or > > 2. A search path string in the field entitled: "Look in:" Quote: > > I tried using Sendkeys, > > (Alt-L = "Lookin in:" field) > > (Alt-O = Filename/filemask field, "All or part of the file name:") > > (Alt-R = "Search" button) > > But Sendkeys doesn't seem to trigger any action at all in the search > Quote: > > Any suggestions would be much appreciated. Quote: > > Marceepoo Quote: > > Dim objShell > > Set objShell = WScript.CreateObject("Shell.Application") > > objShell.FindFiles > This should help... > > Dim objShell, WshShell > Set objShell = WScript.CreateObject("Shell.Application") > set WshShell = WScript.CreateObject("WScript.Shell") > objShell.FindFiles > WScript.Sleep 500 > WshShell.AppActivate "Find: All files" > WScript.Sleep 500 > WshShell.SendKeys "foo{tab}bar{tab}" > WScript.Sleep 500 > WshShell.SendKeys "c:\windows{enter}" > > -- > Todd Vargo > (Post questions to group only. Remove "z" to email personal messages) You use Win98, don't you? I ask because in XP, the FindFiles caption is "Search Results" which points out one of the many problems with a Sendkeys application. The closest I could get to a usable (?) solution was something like this ... Dim objShell, WshShell CreateObject("Shell.Application").FindFiles with CreateObject("WScript.Shell") do until .AppActivate("Find: All files") or _ .AppActivate("Search Results") wsh.Sleep 500 Loop wsh.Sleep 2000 if .AppActivate("Search Results") then _ .Sendkeys "{Tab 5}{enter}" : wsh.Sleep 200 .SendKeys "foo{tab}bar{tab}" : wsh.Sleep 200 .SendKeys "c:\windows" end with I still don't like it because of the open loop two second delay required (on my machine) between confirming that the search screen was open and the time the first keystroke could be sent reliably to it (under XP). Without the delay, I kept opening the Internet search function, instead. This is a case where AutoIt (third party control - google search to find a free copy) might be almost essential. Tom Lavedas =========== http://members.cox.net/tglbatch/wsh/ |
My System Specs![]() |
| | #3 (permalink) |
| | Re: automation of Windows Explorer search window Tom Lavedas wrote: Quote: > Todd Vargo wrote: Quote: Quote: > > WshShell.AppActivate "Find: All files" > Todd, > > You use Win98, don't you? I ask because in XP, the FindFiles caption > is "Search Results" which points out one of the many problems with a > Sendkeys application. needs/OS. On the one hand, the code seems obvious (to me) so I forget, but OTOH, SCRIPT56.CHM is available. -- Todd Vargo (Post questions to group only. Remove "z" to email personal messages) |
My System Specs![]() |
| | #4 (permalink) |
| | Re: automation of Windows Explorer search window I just went to my XP machine & did a couple of searches, saved them, & then examined the contents in notepad (hex editor would probably be better). There is some binary gobbledygook but it seems to be constant -- and you also see your search terms as both ascii & unicode strings. You may be able to construct a saved search file with the terms you want & then open that, avoiding the use of sendkeys. -- Good Luck, Keith Microsoft MVP [Windows Shell/User] "Tom Lavedas" <tglbatch@xxxxxx> wrote in message news:dcea7a91-608e-4212-803c-6341cbc32d0e@xxxxxx Quote: > On May 28, 11:09 pm, "Todd Vargo" <tlva...@xxxxxx> wrote: Quote: >> Marceepoo wrote: Quote: >> > The vbscript below opens a Windows Explorer search window. >> > The Windows Explorer search window has fields in which the user can >> > insert Quote: >> > search String Filter, and a search path String. >> > I can't figure out what code to use to insert: >> > 1. A search filter string in the field entitled "All or part of the Quote: >> > name"; Or >> > 2. A search path string in the field entitled: "Look in:" Quote: >> > I tried using Sendkeys, >> > (Alt-L = "Lookin in:" field) >> > (Alt-O = Filename/filemask field, "All or part of the file name:") >> > (Alt-R = "Search" button) >> > But Sendkeys doesn't seem to trigger any action at all in the search >> Quote: >> > Any suggestions would be much appreciated. Quote: >> > Marceepoo Quote: >> > Dim objShell >> > Set objShell = WScript.CreateObject("Shell.Application") >> > objShell.FindFiles >> This should help... >> >> Dim objShell, WshShell >> Set objShell = WScript.CreateObject("Shell.Application") >> set WshShell = WScript.CreateObject("WScript.Shell") >> objShell.FindFiles >> WScript.Sleep 500 >> WshShell.AppActivate "Find: All files" >> WScript.Sleep 500 >> WshShell.SendKeys "foo{tab}bar{tab}" >> WScript.Sleep 500 >> WshShell.SendKeys "c:\windows{enter}" >> >> -- >> Todd Vargo >> (Post questions to group only. Remove "z" to email personal messages) > Todd, > > You use Win98, don't you? I ask because in XP, the FindFiles caption > is "Search Results" which points out one of the many problems with a > Sendkeys application. > > The closest I could get to a usable (?) solution was something like > this ... > > Dim objShell, WshShell > CreateObject("Shell.Application").FindFiles > with CreateObject("WScript.Shell") > do until .AppActivate("Find: All files") or _ > .AppActivate("Search Results") > wsh.Sleep 500 > Loop > wsh.Sleep 2000 > if .AppActivate("Search Results") then _ > .Sendkeys "{Tab 5}{enter}" : wsh.Sleep 200 > .SendKeys "foo{tab}bar{tab}" : wsh.Sleep 200 > .SendKeys "c:\windows" > end with > > I still don't like it because of the open loop two second delay > required (on my machine) between confirming that the search screen was > open and the time the first keystroke could be sent reliably to it > (under XP). Without the delay, I kept opening the Internet search > function, instead. > > This is a case where AutoIt (third party control - google search to > find a free copy) might be almost essential. > > Tom Lavedas > =========== > http://members.cox.net/tglbatch/wsh/ |
My System Specs![]() |
![]() |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Forum | |||
| windows explorer has stopped working....window explorer restarting | Vista General | |||
| Windows Explorer search parameters | Vista General | |||
| Someone help me fix my Windows Explorer Search Please! | Vista file management | |||
| Windows Explorer Search | Vista General | |||
| Maddening Windows Explorer Search Window Opens on Mouse Movement | Vista General | |||