Jump to content

chrisand1998

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by chrisand1998

  1. This is my old experiment project to center the windows 10 taskbar before making FalconX in .NET Source: https://github.com/ChrisAnd1998/Falcon10-AutoIt ;~ Example 13 Details about the right pane of the windows explorer #include "CUIAutomation2.au3" #include <MsgBoxConstants.au3> #include <File.au3> #include <WinAPI.au3> #NoTrayIcon Opt("TrayMenuMode", 3) Opt( "MustDeclareVars", 1 ) Global $oUIAutomation Global $CountXXX Global $Lefts Global $siz ;_ProcessCloseOtherEx(@ScriptName) _Restart_Explorer() sleep(1000) MainFunc() Func Center() Local $iFullDesktopWidth = @DesktopWidth Local $ico = $CountXXX * $siz[2] + 1 - $siz[3] Local $half = $ico / 2 Local $x = $iFullDesktopWidth / 2 Local $x2 = $x - $half Local $x3 = $x2 - $Lefts[0] ControlMove("[CLASS:Shell_TrayWnd]", "", "[CLASS:MSTaskListWClass; INSTANCE:1]", 0, 0, 3000, 40) ControlMove("[CLASS:Shell_TrayWnd]", "", "[CLASS:ReBarWindow32; INSTANCE:1]", $x2, 0, $ico + 50, 40) EndFunc Func MainFunc() TraySetToolTip("Falcon10") ControlMove("[CLASS:Shell_TrayWnd]", "", "[CLASS:MSTaskListWClass; INSTANCE:1]", 0, 0, 3000, 40) $Lefts = ControlGetPos("[CLASS:Shell_TrayWnd]", "", "[CLASS:MSTaskListWClass; INSTANCE:1]") $siz = ControlGetPos("[CLASS:Shell_TrayWnd]", "", "[CLASS:Start; INSTANCE:1]") Local $hWindow = ControlGetHandle( "[CLASS:Shell_TrayWnd]","","[CLASS:MSTaskListWClass; INSTANCE:1]") $oUIAutomation = ObjCreateInterface( $sCLSID_CUIAutomation, $sIID_IUIAutomation, $dtagIUIAutomation ) Local $pWindow $oUIAutomation.ElementFromHandle( $hWindow, $pWindow ) Local $oWindow = ObjCreateInterface( $pWindow, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) While 1 Center() sleep(500) ListDescendants( $oWindow, 0, 1 ) Center() Wend EndFunc Func _Restart_Explorer() Local $ifailure = 100, $zfailure = 100, $rPID = 0, $iExplorerPath = @WindowsDir & "\Explorer.exe" _WinAPI_ShellChangeNotify($shcne_AssocChanged, 0, 0, 0) ; Save icon positions Local $hSystray = _WinAPI_FindWindow("Shell_TrayWnd", "") _SendMessage($hSystray, 1460, 0, 0) ; Close the Explorer shell gracefully While ProcessExists("Explorer.exe") ; Try Close the Explorer Sleep(10) $ifailure -= ProcessClose("Explorer.exe") ? 0 : 1 If $ifailure < 1 Then Return SetError(1, 0, 0) WEnd ;~ _WMI_StartExplorer() While (Not ProcessExists("Explorer.exe")) ; Start the Explorer If Not FileExists($iExplorerPath) Then Return SetError(-1, 0, 0) Sleep(500) $rPID = ShellExecute($iExplorerPath) $zfailure -= $rPID ? 0 : 1 If $zfailure < 1 Then Return SetError(2, 0, 0) WEnd Return $rPID EndFunc ;==>_Restart_Explorer Func _ProcessCloseOtherEx($sPID) If IsString($sPID) Then $sPID = ProcessExists($sPID) If Not $sPID Then Return SetError(1, 0, 0) If $sPID <> @AutoItPID Then Run(@ComSpec & " /c taskkill /F /PID " & $sPID & " /T", @SystemDir, @SW_HIDE) _ProcessCloseOtherEx($sPID) Else Return EndIf EndFunc ;==>_ProcessCloseOtherEx Func ListDescendants( $oParent, $iLevel, $iLevels = 0 ) If Not IsObj( $oParent ) Then Return If $iLevels And $iLevel = $iLevels Then Return Local $pRawWalker, $oRawWalker $oUIAutomation.RawViewWalker( $pRawWalker ) $oRawWalker = ObjCreateInterface( $pRawWalker, $sIID_IUIAutomationTreeWalker, $dtagIUIAutomationTreeWalker ) Local $pUIElement, $oUIElement $oRawWalker.GetFirstChildElement( $oParent, $pUIElement ) $oUIElement = ObjCreateInterface( $pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) Local $sIndent = "" For $i = 0 To $iLevel - 1 $sIndent &= " " Next $CountXXX = 0 While IsObj( $oUIElement ) ; ConsoleWrite( $sIndent & _UIA_getPropertyValue( $oUIElement, $UIA_NamePropertyId ) & @CRLF) $CountXXX = $CountXXX + 1 ; ListDescendants( $oUIElement, $iLevel + 1, $iLevels ) $oRawWalker.GetNextSiblingElement( $oUIElement, $pUIElement ) $oUIElement = ObjCreateInterface( $pUIElement, $sIID_IUIAutomationElement, $dtagIUIAutomationElement ) WEnd ;ConsoleWrite($CountXXX -1 & @CRLF) EndFunc Func _UIA_getPropertyValue( $obj, $id ) Local $tVal $obj.GetCurrentPropertyValue( $id, $tVal ) If Not IsArray( $tVal ) Then Return $tVal Local $tStr = $tVal[0] For $i = 1 To UBound( $tVal ) - 1 $tStr &= "; " & $tVal[$i] Next Return $tStr EndFunc
  2. Hello I need some help reading a memory address from explorer.exe. In VB.NET i wrote a tool that centers the windows 10 taskbar icons automatically. it reads the amount of icons from explorer.exe (base+0x002B8538) then it calculates what the position will be for (MSTaskListWClass). And then it moves (MSTaskListWClass) to the right position using autoitX. (In realtime using a timer). Written for Windows 10 x64 Now i want to script it in Autoit only. But all the solutions about reading memory addresses are very old and do not work for me . I also tried this as an alternative #Include <GuiToolBar.au3> $hWnd = ControlGetHandle("[CLASS:Shell_TrayWnd]", "", "[CLASS:MSTaskListWClass;INSTANCE:1]") $iCount = _GUICtrlToolbar_ButtonCount($hWnd) ConsoleWrite($iCount & @CRLF) With no success, i tried all controls from _GUICtrl Does anyone have a solution?
×
×
  • Create New...