MartiniThePilot Posted February 21, 2008 Posted February 21, 2008 Hi,while using AutoIt V3 and reading this forum for quite a while - I almost found here any answer I need - since now...This is really a great language and a very helpful community - thanks my friends! Currently I'm busy adding some functionality to Mindjets MindManager V7. Their developer documentation is more or less poor, see yourself at http://www.mindjet.com/us/devzone/7/mm7_ob...odel/index.html.First, I would like to iterate through all existing topics of a map. See attached picture of the sample map I used.To iterate through the topics, there is a "NewTopicFinder" which iterates through the branches (topics) itself and fires an event for each topic found.Works fine with the following Visual Basic code:CODEDim WithEvents Iterator As TopicFinderSub MainDim oTopic As TopicSet oTopic = Activedocument.CentralTopicSet Iterator = oTopic.NewTopicFinderIterator.StartEnd SubPrivate Sub Iterator_TopicFound (oTopicFound As Topic)MsgBox(oTopicFound.Text, vbOkOnly)End SubThis code returns:RootKnot1Leaf11Leaf12Leaf13Knot2Knot3Leaf31Ok, now my AutoIt translation:CODE#include <Constants.au3> ;Standard AutoIt constants#include <IE.au3> ;Internet Explorer User Defined Functions_IEErrorHandlerRegister()Local $oMindApp = ObjCreate("MindManager.Application")ConsoleWrite(" Name: " & $oMindApp.Name & @CRLF) ;Mindmanager 7: "Mindjet MindManager"ConsoleWrite("Version: " & $oMindApp.ObjectModelVersion & @CRLF) ;Mindmanager 7: "7.0.1";Comparision with Visual Basic code starts hereLocal $Events ;ObjEventLocal $Iterator ;as TopicFinderLocal $oTopic ;as Topic$oTopic = $oMindApp.Activedocument.CentralTopic$Iterator = $oTopic.NewTopicFinder()$Events = ObjEvent($Iterator, "Iterator_")$Iterator.Start()Exit ;of Script MM7 IteratorFunc Iterator_TopicFound($oTopicFound)ConsoleWrite("Topic.Text: " & $oTopicFound.Text & @CRLF)EndFunc ;of Iterator_TopicFoundRunning this, I get the following output and error:CODE Name: Mindjet MindManagerVersion: 7.0.1--> COM Error Encountered in MM7 Iterator.au3----> $IEComErrorScriptline = 22----> $IEComErrorNumberHex = 00000007----> $IEComErrorNumber = 7----> $IEComErrorWinDescription = Failed to retrieve outgoing Event Interface from Object.----> $IEComErrorDescription = ----> $IEComErrorSource = ----> $IEComErrorHelpFile = ----> $IEComErrorHelpContext = ----> $IEComErrorLastDllError = 0Looks like I have to add the third parm in the ObjEvent() - but how to get the name of the interface?The description of the third parm in the AutoIt help says: Optional name of an Event interface to use. Note: It must be a supported as outgoing for the Object AND it must be of type DISPATCH.I also read the Obj/COM Reference for more details but wasn't able to proceed. Of course, I also would be able to scan manually through all topics, but I would like to get these stuff working. The NewTopicFinder of MindManager7 is quite powerful and supports filters etc.Any other ideas or tips to solve the event issue?Many thanks in advance, Martin
DaleHohm Posted February 21, 2008 Posted February 21, 2008 I have done some MindManager scripting and I'm happy to see someone else attempting this in AutoIt.I have not played with the TopicFinder however. I've used my own recursion routines instead.I can reproduce the same results that you received. I don't expect there to be a syntax-oriented resolution to this.You may want to look at another discussion here related to Outlook that ended badly http://www.autoitscript.com/forum/index.php?showtopic=26745 - I expect that this event interface to this MM object suffers similar limitations. As I suggested in that thread, you may want to experiment with implementing in VBScript to see if you get different/better results.Dale Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
MartiniThePilot Posted February 24, 2008 Author Posted February 24, 2008 Thank you Dale! I also use my own (recursive) routine now without using the NewTopicFinder to avoid the event stuff. You suggested (more) VB testing - something special you have in mind to get closer to an event solution (beside the working VB event solution in the original post) ? Thanks to AutiIt - my MindManager script is now completely working. Basically it does accumulate the planned efforts (called duration in MM7) of the tasks found in the active map, and by using the completion in percent it calculates the efforts planned, done and still open for each node. The results are propagated up the tree so the root contains the sum of all tasks. For easierer tracking, a small text label is written to each node. Additionally, the calculated values are also written into an Excel sheet for easier further usage. I anchorerd the compiled script as .exe through a hyperlink at the root node, so a single click to this link now does the calculation and writes the Excel. If completely finished (documentation), I will post this script to this thread as an MindManager example. Martin
DaleHohm Posted February 24, 2008 Posted February 24, 2008 (edited) Beautiful. I look forward to seeing what you have done. I didn't suggest VB testing, but rather VBScript testing. If you cannot perform a particular COM task in VBScript then it will not likely be possible in AutoIt. Dale Edited February 24, 2008 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead? Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble
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