trex Posted December 10, 2007 Posted December 10, 2007 (edited) Hi guys, The help page for _GUICtrlToolbar_PressButton mentions _GUICtrlToolbar_ClickButton but it is not included in GuiToolbar.au3 Can someone provide the code? I'm using version 3.2.10.0 Thanks Edited December 10, 2007 by trex
GaryFrost Posted December 10, 2007 Posted December 10, 2007 Hi guys, The help page for _GUICtrlToolbar_PressButton mentions _GUICtrlToolbar_ClickButton but it is not included in GuiToolbar.au3 Can someone provide the code? I'm using version 3.2.10.0 Thanks I missed taking that out of the remarks. But no matter it'll end up in the next beta expandcollapse popup; #FUNCTION# ==================================================================================================================== ; Name...........: _GUICtrlToolbar_ClickAccel ; Description ...: Clicks a specific button using it's accelerator ; Syntax.........: _GUICtrlToolbar_ClickAccel($hWnd, $cAccel[, $sButton = "left"[, $fMove = False[, $iClicks = 1[, $iSpeed = 1]]]]) ; Parameters ....: $hWnd - Handle to the control ; $cAccel - Button accelerator ; $sButton - Button to click ; $fMove - Mouse movement flag: ; | True - Mouse will be moved ; |False - Mouse will not be moved ; $iClicks - Number of clicks ; $iSpeed - Mouse movement speed ; Return values .: ; Author ........: Paul Campbell (PaulIA) ; Modified.......: ; Remarks .......: ; Related .......: _GUICtrlToolbar_ClickButton, _GUICtrlToolbar_ClickIndex ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _GUICtrlToolbar_ClickAccel($hWnd, $cAccel, $sButton = "left", $fMove = False, $iClicks = 1, $iSpeed = 1) If $Debug_TB Then _GUICtrlToolbar_ValidateClassName($hWnd) Local $iID $iID = _GUICtrlToolbar_MapAccelerator($hWnd, $cAccel) _GUICtrlToolbar_ClickButton($hWnd, $iID, $sButton, $fMove, $iClicks, $iSpeed) EndFunc ;==>_GUICtrlToolbar_ClickAccel ; #FUNCTION# ==================================================================================================================== ; Name...........: _GUICtrlToolbar_ClickButton ; Description ...: Clicks a specific button ; Syntax.........: _GUICtrlToolbar_ClickButton($hWnd, $iCommandID[, $sButton = "left"[, $fMove = False[, $iClicks = 1[, $iSpeed = 1]]]]) ; Parameters ....: $hWnd - Handle to the control ; $iCommandID - Button command ID ; $sButton - Button to click ; $fMove - Mouse movement flag: ; | True - Mouse will be moved ; |False - Mouse will not be moved ; $iClicks - Number of clicks ; $iSpeed - Mouse movement speed ; Return values .: ; Author ........: Paul Campbell (PaulIA) ; Modified.......: Gary Frost ; Remarks .......: ; Related .......: _GUICtrlToolbar_ClickAccel, _GUICtrlToolbar_ClickIndex ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _GUICtrlToolbar_ClickButton($hWnd, $iCommandID, $sButton = "left", $fMove = False, $iClicks = 1, $iSpeed = 1) If $Debug_TB Then _GUICtrlToolbar_ValidateClassName($hWnd) Local $tPoint, $tRect, $iX, $iY, $iMode, $aPos $tRect = _GUICtrlToolbar_GetButtonRectEx($hWnd, $iCommandID) $tPoint = _WinAPI_PointFromRect($tRect) $tPoint = _WinAPI_ClientToScreen($hWnd, $tPoint) _WinAPI_GetXYFromPoint($tPoint, $iX, $iY) If Not $fMove Then $iMode = Opt("MouseCoordMode", 1) $aPos = MouseGetPos() Opt("MouseCoordMode", $iMode) _WinAPI_ShowCursor(False) MouseClick($sButton, $iX, $iY, $iClicks, $iSpeed) MouseMove($aPos[0], $aPos[1], 0) _WinAPI_ShowCursor(True) Else MouseClick($sButton, $iX, $iY, $iClicks, $iSpeed) EndIf EndFunc ;==>_GUICtrlToolbar_ClickButton ; #FUNCTION# ==================================================================================================================== ; Name...........: _GUICtrlToolbar_ClickIndex ; Description ...: Clicks a specific button using it's index ; Syntax.........: _GUICtrlToolbar_ClickIndex($hWnd, $iIndex[, $sButton = "left"[, $fMove = False[, $iClicks = 1[, $iSpeed = 1]]]]) ; Parameters ....: $hWnd - Handle to the control ; $iIndex - Button index ; $sButton - Button to click ; $fMove - Mouse movement flag: ; | True - Mouse will be moved ; |False - Mouse will not be moved ; $iClicks - Number of clicks ; $iSpeed - Mouse movement speed ; Return values .: ; Author ........: Paul Campbell (PaulIA) ; Modified.......: ; Remarks .......: ; Related .......: _GUICtrlToolbar_ClickAccel, _GUICtrlToolbar_ClickButton ; Link ..........; ; Example .......; Yes ; =============================================================================================================================== Func _GUICtrlToolbar_ClickIndex($hWnd, $iIndex, $sButton = "left", $fMove = False, $iClicks = 1, $iSpeed = 1) If $Debug_TB Then _GUICtrlToolbar_ValidateClassName($hWnd) Local $iCommandID $iCommandID = _GUICtrlToolbar_IndexToCommand($hWnd, $iIndex) _GUICtrlToolbar_ClickButton($hWnd, $iCommandID, $sButton, $fMove, $iClicks, $iSpeed) EndFunc ;==>_GUICtrlToolbar_ClickIndex SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
testmeout Posted January 24, 2008 Posted January 24, 2008 I added the functions into GuiToolbar.au3, but I got the error: C:\Program Files\AutoIt3\Include\GuiToolbar.au3 (2105) : ==> Unknown function name.: $tPoint = _WinAPI_PointFromRect($tRect) $tPoint = ^ ERROR So I also needed to added the following functions into WinAPI.au3, just to let you know. expandcollapse popup; #FUNCTION# ==================================================================================================== ================ ; Description ...: Returns the top/left coordinates of a tagRECT as a tagPOINT structure ; Parameters ....: $tRect - tagRECT structure ; $fCenter - If True, the return will be a point at the center of the rectangle, otherwise the left/top ; +coordinates are returned. ; Return values .: Success - tagPOINT structure ; Author ........: Paul Campbell (PaulIA) ; Remarks .......: This function is used to get the click position for many of the click functions in the library ; Related .......: ; ==================================================================================================== =========================== Func _WinAPI_PointFromRect(ByRef $tRect, $fCenter = True) Local $iX1, $iY1, $iX2, $iY2, $tPoint $iX1 = DllStructGetData($tRect, "Left") $iY1 = DllStructGetData($tRect, "Top") $iX2 = DllStructGetData($tRect, "Right") $iY2 = DllStructGetData($tRect, "Bottom") If $fCenter Then $iX1 = $iX1 + (($iX2 - $iX1) / 2) $iY1 = $iY1 + (($iY2 - $iY1) / 2) EndIf $tPoint = DllStructCreate($tagPOINT) DllStructSetData($tPoint, "X", $iX1) DllStructSetData($tPoint, "Y", $iY1) Return $tPoint EndFunc ;==>_WinAPI_PointFromRect ; #FUNCTION# ==================================================================================================== ================ ; Description ...: Returns the X/Y values from a tagPOINT structure ; Parameters ....: $tPoint - tagPOINT structure ; $iX - X value ; $iY - Y value ; Return values .: ; Author ........: Paul Campbell (PaulIA) ; Remarks .......: This function extracts the X/Y values from a tagPOINT structure ; Related .......: _Lib_GetPointFromXY, _Lib_GetXYFromRect ; ==================================================================================================== =========================== Func _WinAPI_GetXYFromPoint(ByRef $tPoint, ByRef $iX, ByRef $iY) $iX = DllStructGetData($tPoint, "X") $iY = DllStructGetData($tPoint, "Y") EndFunc ;==>_WinAPI_GetXYFromPoint
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