Jump to content

sending commands after _GUICtrlToolbar_ClickButton


Recommended Posts

Hello. I hope everyone is having a great day today and looking forward to a great weekend.

I am new to manipulating GUI in AutoIt, especially built in Windows stuff.

I am having problems sending any command after the execution of _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right")

This command lets me "RightClick" on an icon, but after that no other command responds. 

Ideally, I would like to send("{DOWN}{ENTER}") or send {"e"}, but none of these commands are sent. Even MouseMove(1000,500) doesn't move the cursor.

 

Below is the code.

 

#include <GuiToolbar.au3>

disable_Dragon()
MouseMove(1000,500,10)
send("e")
MsgBox(0,"heh","done")
Exit


func disable_Dragon()
Global $hSysTray_Handle, $iSystray_ButtonNumber

Global $sToolTipTitle = "dragon" ; <<<<<<<<<<<<<<<< Enter some tooltip text for the icon you want here

$iSystray_ButtonNumber = Get_Systray_Index($sToolTipTitle)

If $iSystray_ButtonNumber = 0 Then
MsgBox(16, "Error", "Icon not found in system tray")
;~ Exit
Else
MouseClick("left",1710,1070)
Sleep(100)
_GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right")

MouseMove(1000,500)
Send ("E")

EndIf

EndFunc



Func Get_Systray_Index($sToolTipTitle)

; Find systray handle
;$hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:Button;Instance:2]')
;$hSysTray_Handle = ControlGetHandle('[Class:Shell_TrayWnd]', '', '[Class:ToolbarWindow32;Instance:3]')
$hSysTray_Handle = ControlGetHandle('[Class:NotifyIconOverflowWindow]', '', '[Class:ToolbarWindow32;Instance:1]')

If @error Then
MsgBox(16, "Error", "System tray not found")
;~ Exit
EndIf

; Get systray item count
Local $iSystray_ButCount = _GUICtrlToolbar_ButtonCount($hSysTray_Handle)
If $iSystray_ButCount = 0 Then
MsgBox(16, "Error", "No items found in system tray")
;~ Exit
EndIf

For $i = 0 To $iSysTray_ButCount - 1
$cID = _GUICtrlToolbar_IndexToCommand($hSysTray_Handle, $i)
;MsgBox(0,"heh",(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $cID)))
Next

; Look for wanted tooltip
For $iSystray_ButtonNumber = 0 To $iSystray_ButCount - 1
If StringInStr(_GUICtrlToolbar_GetButtonText($hSysTray_Handle, $iSystray_ButtonNumber), $sToolTipTitle) = 1 Then ExitLoop
Next

If $iSystray_ButtonNumber = $iSystray_ButCount Then
Return 0 ; Not found
Else
Return $iSystray_ButtonNumber ; Found
EndIf

EndFunc

What it's supposed to do is, find an icon called "Dragon". It is always in the Windows 10 overflow system tray, so I access NotifyIconOverFlowWindow class in ControlGetHandle.

I move mouse to click the open hidden tray icon which is at 1710,1070 << unfortunately its not always at this coordinates, so if lucky it will do a mouseclick at the right arrow. Then I will do a _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right") to do a right click on the Dragon system tray icon. What appears on screen now is an Exit button. But I can't seem to use it.

I can't MouseMove to the exit button (relative coordinates are -10,10 to where current cursor appears on screen). I can't send a keyboard "E" using Send("e"). Even if I Sleep(10000) before that, it still won't respond to any command to move mouse or send keyboard key.

So in summary, there are 2 issues
1) I can't get AutoIt to send mouse move command or send key command after performing a _GUICtrlToolbar_ClickButton($hSysTray_Handle, $iSystray_ButtonNumber, "right")

2) I don't know how to press the Arrow key to open the hidden system notification tray. In the Finder Tool it says Class "Shell_TrayWnd" window info, Class "Button" Instance "2" in Basic Control Info. But I don't know how to perform a click on it other than hardcoding its coordinates.
Clipboard02.jpg

Please help.

Thanks!
masCh

 

 

Edited by masCh

-itisallinthemind-

Link to post
Share on other sites
ControlClick('[CLASS:Shell_TrayWnd]', '', '[CLASS:Button; INSTANCE:2]', "left")

This works for me to open the icon "menu" in tray.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to post
Share on other sites

I suspect  _GUICtrlToolbar_ClickButton is for autoit own created toolbars.

Spoiler

Renamer - Rename files and folders, remove portions of text from the filename etc.

GPO Tool - Export/Import Group policy settings.

MirrorDir - Synchronize/Backup/Mirror Folders

BeatsPlayer - Music player.

Params Tool - Right click an exe to see it's parameters or execute them.

String Trigger - Triggers pasting text or applications or internet links on specific strings.

Inconspicuous - Hide files in plain sight, not fully encrypted.

Regedit Control - Registry browsing history, quickly jump into any saved key.

Time4Shutdown - Write the time for shutdown in minutes.

Power Profiles Tool - Set a profile as active, delete, duplicate, export and import.

Finished Task Shutdown - Shuts down pc when specified window/Wndl/process closes.

NetworkSpeedShutdown - Shuts down pc if download speed goes under "X" Kb/s.

IUIAutomation - Topic with framework and examples

Au3Record.exe

Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...