Ram Posted December 31, 2006 Posted December 31, 2006 Hi, I have an VB interface that has toolstrip. I need autoit to click a particular button in the toolstrip but the window info window shows same class ID for all the button in the toolstrip. Can you please let me know what should be done in this particular situation? Awaiting your response! Thanks!
Outshynd Posted December 31, 2006 Posted December 31, 2006 expandcollapse popup;where $x and $y are the coordinates of the button from the top-left of the control... put AU3Info in Client mode _MouseClick(ControlGetHandle("TITLE OF VB APP", "", "CLASSNAME OR CONTROL ID"), "left", $x, $y) Func _MakeLong($LoWord, $HiWord) Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF)) EndFunc Func _MouseClick($hWnd, $button, $x, $y, $times=1, $delay=250) If $hWnd = 0 Then SetError(-1) Return EndIf Local $ix Local $lParam = _MakeLong($x, $y) Local $user32 = DllOpen("user32.dll") $button = StringLower($button) If $button = "left" Then For $ix = 1 To $times DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x200, "int", 0, "long", $lParam) DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x201, "int", 1, "long", $lParam) DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x202, "int", 0, "long", $lParam) If $ix < $times Then Sleep($delay) Next ElseIf $button = "right" Then For $ix = 1 To $times DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x200, "int", 0, "long", $lParam) DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x204, "int", 2, "long", $lParam) DllCall($user32, "int", "PostMessage", "hwnd", $hWnd, "int", 0x205, "int", 0, "long", $lParam) If $ix < $times Then Sleep($delay) Next Else SetError(-2) If $user32 <> -1 Then DllClose($user32) Return EndIf If $user32 <> -1 Then DllClose($user32) EndFunc
Ram Posted January 9, 2007 Author Posted January 9, 2007 Outshynd said: ;where $x and $y are the coordinates of the button from the top-left of the control... put AU3Info in Client mode _MouseClick(ControlGetHandle("TITLE OF VB APP", "", "CLASSNAME OR CONTROL ID"), "left", $x, $y) Thanks..but where is user32.dll where does this call from? i don't hve that dll file with me? all I added was this for example: Run("outlook.Exe") Opt("WinWaitDelay",5000) Opt("WinTitleMatchMode", 2) WinWait("Outlook") $x = 190 $y = 30 _MouseClick(ControlGetHandle("Outlook", "", "Menu Bar"), "left", $x, $y) ..... (your code) but didn't work please let me know asap! Awaiting your response! Thanks!
Outshynd Posted January 9, 2007 Posted January 9, 2007 (edited) Is "Menu Bar" the ClassNameNN of Outlook? I don't know but it sure doesn't look right. Also, if AutoIt runs, you have user32.dll. It comes with Windows. Edited January 9, 2007 by Outshynd
Ram Posted January 9, 2007 Author Posted January 9, 2007 Outshynd said: Is "Menu Bar" the ClassNameNN of Outlook? I don't know but it sure doesn't look right.Also, if AutoIt runs, you have user32.dll. It comes with Windows.My Mistake... it is MsoCommandBar1...Anyways, I changed that but didn't workTHis is Active Window Info!>>>>>>>>>>>> Window Details <<<<<<<<<<<<<Title: Inbox - Microsoft OutlookClass: rctrl_renwnd32Size: X: 1 Y: 1 W: 1023 H: 767>>>>>>>>>>> Mouse Details <<<<<<<<<<<Client: X: 187 Y: 16Cursor ID: 2>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<RGB: Hex: 0x00025C Dec: 604>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<Size: X: 0 Y: 0 W: 1015 H: 27Control ID: ClassNameNN: MsoCommandBar1Text: Menu BarStyle: 0x56000000ExStyle: 0x00000000And I changed the code toRun("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE" )WinWait("Outlook")$x = 187$y = 16_MouseClick(ControlGetHandle("Outlook", "", "MsoCommandBar1"), "left", $x, $y) ... and your code down here..but still I don't see it working...!! Do you have user32.dll file.. if so please send it..!! let me try it out because I don't see user32.dll in my computer!!??
Moderators SmOke_N Posted January 9, 2007 Moderators Posted January 9, 2007 Ram said: My Mistake... it is MsoCommandBar1...Anyways, I changed that but didn't workTHis is Active Window Info!>>>>>>>>>>>> Window Details <<<<<<<<<<<<<Title: Inbox - Microsoft OutlookClass: rctrl_renwnd32Size: X: 1 Y: 1 W: 1023 H: 767>>>>>>>>>>> Mouse Details <<<<<<<<<<<Client: X: 187 Y: 16Cursor ID: 2>>>>>>>>>>> Pixel Color Under Mouse <<<<<<<<<<<RGB: Hex: 0x00025C Dec: 604>>>>>>>>>>> Control Under Mouse <<<<<<<<<<<Size: X: 0 Y: 0 W: 1015 H: 27Control ID: ClassNameNN: MsoCommandBar1Text: Menu BarStyle: 0x56000000ExStyle: 0x00000000And I changed the code toRun("C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK.EXE" )WinWait("Outlook")$x = 187$y = 16_MouseClick(ControlGetHandle("Outlook", "", "MsoCommandBar1"), "left", $x, $y) ... and your code down here..but still I don't see it working...!! Do you have user32.dll file.. if so please send it..!! let me try it out because I don't see user32.dll in my computer!!??Start >> Search >> All Files >> User32.dllCool that you have one too huh? Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Outshynd Posted January 9, 2007 Posted January 9, 2007 (edited) Outshynd said: Also, if AutoIt runs, you have user32.dll. It comes with Windows.^Are you getting any error? You may want to do something like MsgBox(64, "ControlHandle", ControlGetHandle("Outlook", "", "MsoCommandBar1")) to make sure it's not returning zero. Edited January 9, 2007 by Outshynd
Ram Posted January 9, 2007 Author Posted January 9, 2007 Outshynd said: ^Are you getting any error? You may want to do something like MsgBox(64, "ControlHandle", ControlGetHandle("Outlook", "", "MsoCommandBar1")) to make sure it's not returning zero.When I put the above I get a msg box with (0x002b037c) and the numbers keep changing everytime....Not sure what to do??
someone Posted January 9, 2007 Posted January 9, 2007 It seems like I'm having the exact same problem as Ram; I am trying to work with a program that has a bar of tabs all of which have the same ID and classname. I posted a topic in support but so far no one has responded... I have some pics of the toolbar and autoit info maybe it will help someone shed some light on this for us. Heres my topic http://www.autoitscript.com/forum/index.php?showtopic=39075Also I used LxPs _ControlGetHandleByPos and I get a number like what Ram got (0x00B00592).Thanks,Andrew While ProcessExists('Andrews bad day.exe') BlockInput(1) SoundPlay('Music.wav') SoundSetWaveVolume('Louder') WEnd
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