sladisch Posted May 30, 2013 Share Posted May 30, 2013 Hi @ all, I'm quite new to autoit and I try to automate the postprocessing of an FEA using Autodesk Mechanical Simulation. For this I need to double click an item in a SysTreeView32. I think the tree view was modified by autodesk. Because on the top level I can only expand the activated item. Activating another item causes some calculation. Here you can sse the tree: This what i have so far (some sleeps and console print to check the script): expandcollapse popupFunc _Au3Setup() Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) EndFunc Func _WinWaitActivate($title,$text,$timeout=10) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc _Au3Setup() _WinWaitActivate("Autodesk Simulation Mechanical 2013","") ConsoleWrite (@CRLF & "WinWaitActive") #Include <GuiTreeView.au3> $hwnd = ControlGetHandle ( "Autodesk Simulation Mechanical", "", "[CLASS:SysTreeView32; INSTANCE:2]" ) ControlTreeView ( "Autodesk Simulation Mechanical", "", "[CLASS:SysTreeView32; INSTANCE:2]", "Expand", "#0" ) ConsoleWrite (@CRLF & "Collapse") Sleep(1500) ControlTreeView ( "Autodesk Simulation Mechanical", "", "[CLASS:SysTreeView32; INSTANCE:2]", "Expand", "#0|#8" ) ConsoleWrite (@CRLF & "Expand") Sleep(1500) ControlTreeView ( "Autodesk Simulation Mechanical", "", "[CLASS:SysTreeView32; INSTANCE:2]", "Select", "#0|#8" ) ConsoleWrite (@CRLF & "Select") Sleep(1500) $control=ControlTreeView ( "Autodesk Simulation Mechanical", "", "[CLASS:SysTreeView32; INSTANCE:2]", "GetText", "#0|#8" ) _WinAPI_SetFocus(ControlGetHandle("Test", "", $hInput)) $find=_GUICtrlTreeView_FindItem ( $hwnd, $control ) $bla=_GUICtrlTreeView_ClickItem ( $hwnd, $find, "left", False, 2 ) ConsoleWrite (@CRLF & $control) AutoIt Info says: expandcollapse popup>>>> Window <<<< Title: Autodesk Simulation Mechanical 2013 - [Ergebnisse - [dynamische_lastffaelle : Stress]] Class: AlgFrame_MainWindow Position: -8, -8 Size: 1936, 1056 Style: 0x15CF0000 ExStyle: 0x00000110 Handle: 0x001F0AD6 >>>> Control <<<< Class: SysTreeView32 Instance: 2 ClassnameNN: SysTreeView322 Name: Advanced (Class): [CLASS:SysTreeView32; INSTANCE:2] ID: 101 Text: Position: 10, 203 Size: 435, 819 ControlClick Coords: 255, 362 Style: 0x5010002F ExStyle: 0x00000000 Handle: 0x001508A4 >>>> Mouse <<<< Position: 265, 557 Cursor ID: 0 Color: 0xFFFFFF >>>> StatusBar <<<< 1: 2: 3: 4: 5: >>>> ToolsBar <<<< >>>> Visible Text <<<< Ergebnisse - [dynamische_lastffaelle : Stress] FEM-Editor - [dynamische_lastffaelle.fem] AdImpApplicationFrame QATHwndSource InfoCenterHwndSource RibbonBar RibbonHwndSource Autodesk Simulation Mechanical Autodesk Simulation Mechanical >>>> Hidden Text <<<< Fatigue Wizard Werkzeuge Geometrie Berechnung Automatische Vernetzungswerkzeuge Netz Optionen anzeigen Anzeigeoptionen Blickwinkel Auswahlform Bearbeiten Animation Allgemeine Optionen Schnittflächen Lastfall Ergebnisoptionen Anzeigeoptionen Auswahl Auswahlform Blickwinkel Actions Bearbeiten Fenster Datei Menueleiste Thank you for your help! Link to comment Share on other sites More sharing options...
guinness Posted May 30, 2013 Share Posted May 30, 2013 (edited) Maybe try... ControlTreeView('[CLASS:AlgFrame_MainWindow]', '', '[CLASS:SysTreeView32; INSTANCE:2]', 'Check', 0) ; You might need to change the index. Edit: Oh and welcome to the Forum, just saw the rest of the code and seems you know quite a bit already. hmm, dunno if that code above will work then?! Edited May 30, 2013 by guinness olo 1 UDF List: _AdapterConnections() • _AlwaysRun() • _AppMon() • _AppMonEx() • _ArrayFilter/_ArrayReduce • _BinaryBin() • _CheckMsgBox() • _CmdLineRaw() • _ContextMenu() • _ConvertLHWebColor()/_ConvertSHWebColor() • _DesktopDimensions() • _DisplayPassword() • _DotNet_Load()/_DotNet_Unload() • _Fibonacci() • _FileCompare() • _FileCompareContents() • _FileNameByHandle() • _FilePrefix/SRE() • _FindInFile() • _GetBackgroundColor()/_SetBackgroundColor() • _GetConrolID() • _GetCtrlClass() • _GetDirectoryFormat() • _GetDriveMediaType() • _GetFilename()/_GetFilenameExt() • _GetHardwareID() • _GetIP() • _GetIP_Country() • _GetOSLanguage() • _GetSavedSource() • _GetStringSize() • _GetSystemPaths() • _GetURLImage() • _GIFImage() • _GoogleWeather() • _GUICtrlCreateGroup() • _GUICtrlListBox_CreateArray() • _GUICtrlListView_CreateArray() • _GUICtrlListView_SaveCSV() • _GUICtrlListView_SaveHTML() • _GUICtrlListView_SaveTxt() • _GUICtrlListView_SaveXML() • _GUICtrlMenu_Recent() • _GUICtrlMenu_SetItemImage() • _GUICtrlTreeView_CreateArray() • _GUIDisable() • _GUIImageList_SetIconFromHandle() • _GUIRegisterMsg() • _GUISetIcon() • _Icon_Clear()/_Icon_Set() • _IdleTime() • _InetGet() • _InetGetGUI() • _InetGetProgress() • _IPDetails() • _IsFileOlder() • _IsGUID() • _IsHex() • _IsPalindrome() • _IsRegKey() • _IsStringRegExp() • _IsSystemDrive() • _IsUPX() • _IsValidType() • _IsWebColor() • _Language() • _Log() • _MicrosoftInternetConnectivity() • _MSDNDataType() • _PathFull/GetRelative/Split() • _PathSplitEx() • _PrintFromArray() • _ProgressSetMarquee() • _ReDim() • _RockPaperScissors()/_RockPaperScissorsLizardSpock() • _ScrollingCredits • _SelfDelete() • _SelfRename() • _SelfUpdate() • _SendTo() • _ShellAll() • _ShellFile() • _ShellFolder() • _SingletonHWID() • _SingletonPID() • _Startup() • _StringCompact() • _StringIsValid() • _StringRegExpMetaCharacters() • _StringReplaceWholeWord() • _StringStripChars() • _Temperature() • _TrialPeriod() • _UKToUSDate()/_USToUKDate() • _WinAPI_Create_CTL_CODE() • _WinAPI_CreateGUID() • _WMIDateStringToDate()/_DateToWMIDateString() • Au3 script parsing • AutoIt Search • AutoIt3 Portable • AutoIt3WrapperToPragma • AutoItWinGetTitle()/AutoItWinSetTitle() • Coding • DirToHTML5 • FileInstallr • FileReadLastChars() • GeoIP database • GUI - Only Close Button • GUI Examples • GUICtrlDeleteImage() • GUICtrlGetBkColor() • GUICtrlGetStyle() • GUIEvents • GUIGetBkColor() • Int_Parse() & Int_TryParse() • IsISBN() • LockFile() • Mapping CtrlIDs • OOP in AutoIt • ParseHeadersToSciTE() • PasswordValid • PasteBin • Posts Per Day • PreExpand • Protect Globals • Queue() • Resource Update • ResourcesEx • SciTE Jump • Settings INI • SHELLHOOK • Shunting-Yard • Signature Creator • Stack() • Stopwatch() • StringAddLF()/StringStripLF() • StringEOLToCRLF() • VSCROLL • WM_COPYDATA • More Examples... Updated: 22/04/2018 Link to comment Share on other sites More sharing options...
sladisch Posted May 30, 2013 Author Share Posted May 30, 2013 Now im running into another Problem. It seems, that the access via ControlTreeView doesn't work. I reduced the script to do some testing. Both Commands throw errors. Func _Au3Setup() Opt('WinDetectHiddenText',1) Opt('MouseCoordMode',0) EndFunc Func _WinWaitActivate($title,$text,$timeout=10) WinWait($title,$text,$timeout) If Not WinActive($title,$text) Then WinActivate($title,$text) WinWaitActive($title,$text,$timeout) EndFunc _Au3Setup() _WinWaitActivate("Autodesk Simulation Mechanical 2013","") ConsoleWrite (@CRLF & "WinWaitActive") $class_treeview = "[CLASS:SysTreeView32; INSTANCE:2]" ControlTreeView("Autodesk Simulation Mechanical 2013", "", $class_treeview, "Expand", "#0") If @error Then MsgBox(4096, "Test", "Item not expanded", 10) Else MsgBox(4096, "Test", "Item expanded", 10) EndIf ControlTreeView("Autodesk Simulation Mechanical 2013", "", $class_treeview, "Check", "#0") If @error Then MsgBox(4096, "Test", "Item not checked", 10) Else MsgBox(4096, "Test", "Item checked", 10) EndIf Link to comment Share on other sites More sharing options...
bazinguuh Posted June 11, 2013 Share Posted June 11, 2013 Hi all, I am new to autoit and I have an urgent question: What if there are several trees in my GUI, and according to Autoit Windows Info, they all have the same class and instance such as "[CLASS:SysTreeView32; INSTANCE:1]" I only want to expand ONE specific tree. Thanks! Link to comment Share on other sites More sharing options...
FireFox Posted June 11, 2013 Share Posted June 11, 2013 (edited) Hi, I never faced this, but you can try to enumerate the controls with the function _WinAPI_EnumChildWindows (available in the WinAPIEx UDF) and according to the class find the handle of the 2nd treeview. Then you can manipulate it with the _GUICtrlTreeView* functions. Edit: Please next time make another topic instead of hijacking this one. Br, FireFox. Edited June 11, 2013 by FireFox 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