zaetep Posted August 31, 2011 Share Posted August 31, 2011 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 Link to comment Share on other sites More sharing options...
rcmaehl Posted August 31, 2011 Share Posted August 31, 2011 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 WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
zaetep Posted August 31, 2011 Author Share Posted August 31, 2011 Which version of windows. Please include full info. EG: Windows XP Professional Service Pack 3 64-bitWindows XP Professional Service Pack 3 32-bit Version 2002 Link to comment Share on other sites More sharing options...
rcmaehl Posted August 31, 2011 Share Posted August 31, 2011 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 WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
zaetep Posted August 31, 2011 Author Share Posted August 31, 2011 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. Link to comment Share on other sites More sharing options...
rcmaehl Posted August 31, 2011 Share Posted August 31, 2011 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 WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
zaetep Posted August 31, 2011 Author Share Posted August 31, 2011 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 Link to comment Share on other sites More sharing options...
rcmaehl Posted August 31, 2011 Share Posted August 31, 2011 How about _GUICtrlToolbar_CheckButton()? 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 WhyNotWin11Cisco Finesse, Github, IRC UDF, WindowEx UDF Link to comment Share on other sites More sharing options...
zaetep Posted August 31, 2011 Author Share Posted August 31, 2011 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) Link to comment Share on other sites More sharing options...
zaetep Posted August 31, 2011 Author Share Posted August 31, 2011 Is there a way of sending keystrokes while the machine is locked? Link to comment Share on other sites More sharing options...
aNewLyfe Posted August 31, 2011 Share Posted August 31, 2011 have you tried ControlSend() yet ? ~ Every Living Thing is a Code Snippet of World Application ~ Link to comment Share on other sites More sharing options...
monoscout999 Posted August 31, 2011 Share Posted August 31, 2011 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 Link to comment Share on other sites More sharing options...
zaetep Posted September 6, 2011 Author Share Posted September 6, 2011 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, $ (Thanks to everyone else who had a go too) Link to comment Share on other sites More sharing options...
Zedna Posted September 6, 2011 Share Posted September 6, 2011 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 Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
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