Jump to content

Recommended Posts

Posted

Hi, I am writing a script to run a software package overnight.

The PC needs to be locked during this time ([windows key] + L).

The program presses various GUI controls on the 3rd party software in a certain order.

There is one toolbar button i need to press (as well as several buttons and menus which are no problem)

I am able to click buttons when it is locked using _GUICtrlButton_Click() as controlClick() won't work, but the toolbar version of this function _GUICtrlToolbar_ClickButton() needs to use the mouse pointer and so doesn't work when the computer is locked or the window isn't the active window.

Any help would be greatly appreciated

Posted

Which version of windows. Please include full info. EG: Windows XP Professional Service Pack 3 64-bit

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Posted

Which version of windows. Please include full info. EG: Windows XP Professional Service Pack 3 64-bit

Windows XP Professional Service Pack 3 32-bit Version 2002
Posted

Send an Alt keypress, which SHOULD go to the Toolbar, then use the left and right arrow keys to navigate to the toolbar item, then use spacebar (or enter) to open the toolbar. Feel free to modify this however it SHOULD work.

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Posted

Send an Alt keypress, which SHOULD go to the Toolbar, then use the left and right arrow keys to navigate to the toolbar item, then use spacebar (or enter) to open the toolbar. Feel free to modify this however it SHOULD work.

Thanks, however send commands don't seem to work while the PC is locked, no keyboard or mouse functions are available as there are no active windows.
Posted
Totally failed there. Got my Linux and Windows knowledge mixed up. However try _GUICtrlToolbar_PressButton instead of _GUICtrlToolbar_ClickButton()

My UDFs are generally for me. If they aren't updated for a while, it means I'm not using them myself. As soon as I start using them again, they'll get updated.

My Projects

WhyNotWin11
Cisco FinesseGithubIRC UDFWindowEx UDF

 

Posted

Totally failed there. Got my Linux and Windows knowledge mixed up. However try _GUICtrlToolbar_PressButton instead of _GUICtrlToolbar_ClickButton()

I've tried that but it doesn't seem to actually activate the control (even when not locked), i also tried pressing and releasing the button but it does nothing.

_GUICtrlToolbar_PressButton($b, "Channel")

Sleep(1000)

_GUICtrlToolbar_PressButton($b, "Channel", False)

_GUICtrlToolbar_ClickButton($b,"Channel") works but only when the window is active

Posted

How about _GUICtrlToolbar_CheckButton()?

Once again just makes the button look like its pressed without actually activating it (although it seems to work when the PC is locked)

I have been trying to find something that can use: _GUICtrlToolbar_SetCmdID($b,4, $cd) and then use the identifier to operate the button directly (the way _GUICtrlButton_Click($cd) works)

Posted

Edit this Sppet and try it...

#include <WindowsConstants.au3>
#Include <winapi.au3>
#Include <GuiToolBar.au3>
ShellExecute("SnippingTool.exe")
WinWait("[CLASS:Microsoft-Windows-Tablet-SnipperToolbar]")
$winHndl = wingethandle("[CLASS:Microsoft-Windows-Tablet-SnipperToolbar]")
$toolbarHndl = ControlGetHandle($winHndl,"","[CLASS:ToolbarWindow32; INSTANCE:1]")

_sendclick()

Func _sendclick()
    Local $lParam = $toolbarHndl
    Local $BN_CLICKED = 0x0000FFFF
    Local $NID = 219
    local $wParam = _WinAPI_MakeLong($NID, $BN_CLICKED)
    $message = _WinAPI_PostMessage($winHndl,$WM_COMMAND,$wParam,$lParam)
EndFunc   ;==>_sendclick
Posted

THANKYOU Monoscout!!!!!!!!!! Got it working

Local $w = WinGetHandle("MC", "")

Local $b = ControlGetHandle("MC", "", "[CLASSNN:ToolbarWindow321]")

Local $cid = _GUICtrlToolbar_IndexToCommand($b, 4)

Local $wParam = _WinAPI_MakeLong($cid, $BN_CLICKED)

$message = _WinAPI_PostMessage($w, $WM_COMMAND, $wParam, $:mellow:

(Thanks to everyone else who had a go too)

Posted

Just for reference, here are apropriate MSDN links as explanation of this solution:

Toolbar

http://msdn.microsoft.com/en-us/library/bb760435%28v=VS.85%29.aspx

NM_CLICK (toolbar) Notification Code

http://msdn.microsoft.com/en-us/library/bb760490%28v=VS.85%29.aspx

BN_CLICKED Notification Code

http://msdn.microsoft.com/en-us/library/bb761825%28v=VS.85%29.aspx

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
×
×
  • Create New...