doonyakka Posted September 18, 2010 Posted September 18, 2010 (edited) Hi, I'm trying to get Windows Desktop Search to mimic a behaviour of Google Desktop, whereby the search box is hidden until you press a key combination, which shows the box, focuses it and lets you start typing straight away. I've got as far as hiding and making the box visible, but I can't get ControlClick to place the cursor in the right place. I've used the Window Info Tool to get the correct title, class and ID for the combo box, but I'm not having any luck with it. MouseClick will do it, but it's an ugly solution. Here's the Info Tool summary: >>>> Window <<<< Title: Deskbar Class: BaseBar Position: 455, 328 Size: 296, 71 Style: 0x16CC0000 ExStyle: 0x00000180 Handle: 0x001900F2 >>>> Control <<<< Class: ComboBoxEx32 Instance: 1 ClassnameNN: ComboBoxEx321 Name: Advanced (Class): [CLASS:ComboBoxEx32; INSTANCE:1] ID: 2 Text: MSNTB_Window Position: 0, 5 Size: 288, 22 ControlClick Coords: 38, 12 Style: 0x56010041 ExStyle: 0x00000004 Handle: 0x0029009E >>>> Mouse <<<< Position: 497, 367 Cursor ID: 0 Color: 0xF3FFFF >>>> StatusBar <<<< >>>> ToolsBar <<<< >>>> Visible Text <<<< MSN Toolbar >>>> Hidden Text <<<< MSNTB_Window and here's the code I've written (I commented the solution using MouseClick. I've also tried all sorts of combinations of title, class, ID and coords with ControlClick): #include <Misc.au3> WinSetState("Deskbar", "", @SW_HIDE) HotKeySet("^{down}", "deskbarShow") While 1 Sleep(10) WEnd Func deskbarShow() WinSetState("Deskbar", "", @SW_SHOW) WinActivate("Deskbar") ControlClick("Deskbar", "", "[ID:2]") ;MouseClick("left", 500, 365) WinWaitNotActive("Deskbar") WinSetState("Deskbar", "", @SW_HIDE) EndFunc ;==>deskbarShow I also tried the following instead of ControlClick: $handle = ControlGetHandle("Deskbar", "", 2) _WinAPI_SetFocus($handle) which didn't work either. Any idea where I've gone wrong? Thanks! doonyakka Edited September 18, 2010 by doonyakka
wakillon Posted September 18, 2010 Posted September 18, 2010 I can't get ControlClick to place the cursor in the right place Have you try this ? Func deskbarShow() WinSetState("Deskbar", "MSN Toolbar", @SW_SHOW) WinActivate("Deskbar", 'MSN Toolbar') WinWaitActive ("Deskbar", 'MSN Toolbar') GUICtrlSetCursor ( 'ComboBoxEx321', 4 ) ControlFocus ( 'Deskbar', 'MSN Toolbar', 'ComboBoxEx321' ) WinWaitNotActive("Deskbar", 'MSN Toolbar') WinSetState("Deskbar", "MSN Toolbar", @SW_HIDE) EndFunc ;==>deskbarShow AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
doonyakka Posted September 20, 2010 Author Posted September 20, 2010 Have you try this ? Func deskbarShow() WinSetState("Deskbar", "MSN Toolbar", @SW_SHOW) WinActivate("Deskbar", 'MSN Toolbar') WinWaitActive ("Deskbar", 'MSN Toolbar') GUICtrlSetCursor ( 'ComboBoxEx321', 4 ) ControlFocus ( 'Deskbar', 'MSN Toolbar', 'ComboBoxEx321' ) WinWaitNotActive("Deskbar", 'MSN Toolbar') WinSetState("Deskbar", "MSN Toolbar", @SW_HIDE) EndFunc ;==>deskbarShow I hadn't tried that, but it worked perfectly! Thanks! Any idea why ControlClick doesn't work here? Cheers, doonyakka PS. If anyone wants to use this, note that the single quotes needs to be changed to double quotes.
JohnOne Posted September 20, 2010 Posted September 20, 2010 Try ControlClick("Deskbar", "", "2") or ControlClick("Deskbar", "", "[CLASS:ComboBoxEx32; INSTANCE:1]") AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
wakillon Posted September 20, 2010 Posted September 20, 2010 PS. If anyone wants to use this, note that the single quotes needs to be changed to double quotes.No need to change anything... AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
doonyakka Posted September 20, 2010 Author Posted September 20, 2010 No need to change anything...That's weird...it didn't work for me until I changed it...but fair enough
doonyakka Posted September 20, 2010 Author Posted September 20, 2010 (edited) Try ControlClick("Deskbar", "", "2") or ControlClick("Deskbar", "", "[CLASS:ComboBoxEx32; INSTANCE:1]") I did try both of those before posting my original question. They should work, right? But they don't Anyway, wakillion's solution worked fine. Edited September 20, 2010 by doonyakka
wakillon Posted September 20, 2010 Posted September 20, 2010 I did try both of those before posting my original question. They should work, right? But they don't Anyway, wakillion's solution worked fine.Glad to help you ! AutoIt 3.3.18.0 X86 - SciTE 5.5.7 - WIN 11 24H2 X64 - Other Examples Scripts
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now