aGorilla Posted May 5, 2008 Share Posted May 5, 2008 I've been playing with ModernMenu a bit lately, and I'm quite hooked on it. I've also done a bit of script parsing in the past (using a fairly obscure language) mostly to extract my scripts api, as a form of minimal documentation.Then I started to ponder marrying the two ideas. Wouldn't it be cool if I could 'navigate' my API? To keep it generic, I decided to add an XML file as a middle layer between the script, and the menu. The downside is, you need a parser to generate the XML file (and no, I don't have one yet).Right now, this is _very_ basic, and it's also a bit broken (not doing quite what I have planned). I may not be able to do any more with this until next weekend, so I figured I'd post what I have, and see if I can get some suggestions, improvements, etc.Here's the current XML prototype (I have some additions in mind, but not until this is working completely):<Project> <Name></Name> <Note></Note> <Tray>want to put tray settings - icons, colors, etc. here.</Tray> <File id="#"> <Name></Name> <Note></Note> <Function id="#"> <Name></Name> <Note></Note> <Parameter id="#"> <Name></Name> <Note></Note> <Default></Default> <Reference></Reference> </Parameter> </Function> </File> </Project>Here's an example 'definition.xml' file (using the docs from XMLDomWrapper)expandcollapse popup<Project> <Name>XMLDomWrapper</Name> <File id="1"> <Name>_XMLDomWrapper.au3</Name> <Note></Note> <Function id="1"> <Name>_XMLCreateFile</Name> <Parameter id="1"> <Name>sPath</Name> </Parameter> <Parameter id="2"> <Name>sRootNode</Name> </Parameter> <Parameter id="3"> <Name>bOverwrite</Name> <Default>False</Default> </Parameter> <Note>Creates an XML file with the given name and root.</Note> </Function> <Function id="2"> <Name>_XMLFileOpen</Name> <Parameter id="1"> <Name>sXMLFile</Name> </Parameter> <Parameter id="2"> <Name>sNamespace</Name> <Default/> </Parameter> <Parameter id="3"> <Name>ver</Name> <Default>-1</Default> </Parameter> <Note>Creates an instance of an XML file.</Note> </Function> <Function id="3"> <Name>_XMLGetChildNodes</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Note>Selects XML child Node(s) of an element based on XPath input from root node.</Note> </Function> <Function id="4"> <Name>_XMLGetNodeCount</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Parameter id="2"> <Name>strQry</Name> <Default/> </Parameter> <Parameter id="3"> <Name>iNodeType</Name> <Default>1</Default> </Parameter> <Note>Get node count for specified path and type.</Note> </Function> <Function id="5"> <Name>_XMLGetPath</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Note>Returns a nodes full path based on XPath input from root node.</Note> </Function> <Function id="6"> <Name>_XMLSelectNodes</Name> <Parameter id="1"> <Name>strXPath</Name> <Default/> <Reference></Reference> </Parameter> <Note>Selects XML Node(s) based on XPath input from root node.</Note> </Function> <Function id="7"> <Name>_XMLGetField</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Note>Get XML Field(s) based on XPath input from root node.</Note> </Function> <Function id="8"> <Name>_XMLGetValue</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Note>Get XML Field based on XPath input from root node.</Note> </Function> <Function id="9"> <Name>_XMLGetChildText</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Note>Selects XML child Node(s) of an element based on XPath input from root node.</Note> </Function> <Function id="10"> <Name>_XMLUpdateField</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Parameter id="2"> <Name>strData</Name> </Parameter> <Note>Update existing node(s) based on XPath specs.</Note> </Function> <Function id="11"> <Name>_XMLReplaceChild</Name> <Parameter id="1"> <Name>objOldNode</Name> </Parameter> <Parameter id="2"> <Name>objNewNode</Name> </Parameter> <Parameter id="3"> <Name>ns</Name> <Default/> </Parameter> <Note>Replaces a node with a new node.</Note> </Function> <Function id="12"> <Name>_XMLDeleteNode</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Note>Delete specified XPath node.</Note> </Function> <Function id="13"> <Name>_XMLDeleteAttr</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Parameter id="2"> <Name>strAttrib</Name> </Parameter> <Note>Delete attribute for specified XPath</Note> </Function> <Function id="14"> <Name>_XMLDeleteAttrNode</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Parameter id="2"> <Name>strAttrib</Name> </Parameter> <Note>Delete attribute node for specified XPath</Note> </Function> <Function id="15"> <Name>_XMLGetAttrib</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Parameter id="2"> <Name>strAttrib</Name> </Parameter> <Parameter id="3"> <Name>strQuery</Name> <Default/> </Parameter> <Note>Get XML attribute based on XPath input from root node.</Note> </Function> <Function id="16"> <Name>_XMLGetAllAttrib</Name> <Parameter id="1"> <Name>strXPath</Name> <Default/> </Parameter> <Parameter id="2"> <Name>aName</Name> <Reference>True</Reference> </Parameter> <Parameter id="3"> <Name>aValue</Name> <Reference>True</Reference> </Parameter> <Parameter id="4"> <Name>strQry</Name> <Default/> </Parameter> <Note>Get all XML Field(s) attributes based on XPath input from root node.</Note> </Function> <Function id="17"> <Name>_XMLGetAllAttribIndex</Name> <Parameter id="1"> <Name>strXPath</Name> <Default/> </Parameter> <Parameter id="2"> <Name>aName</Name> <Reference>True</Reference> </Parameter> <Parameter id="3"> <Name>aValue</Name> <Reference>True</Reference> </Parameter> <Parameter id="4"> <Name>strQry</Name> <Default/> </Parameter> <Parameter id="5"> <Name>NodeIndex</Name> <Default>0</Default> </Parameter> <Note>Get all XML Field(s) attributes based on Xpathn and specific index.</Note> </Function> <Function id="18"> <Name>_XMLSetAttrib</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Parameter id="2"> <Name>strAttrib</Name> </Parameter> <Parameter id="3"> <Name>strValue</Name> <Default/> </Parameter> <Note>Set XML Field(s) attributes based on XPath input from root node.</Note> </Function> <Function id="19"> <Name>_XMLCreateCDATA</Name> <Parameter id="1"> <Name>strNode</Name> </Parameter> <Parameter id="2"> <Name>strCDATA</Name> </Parameter> <Parameter id="3"> <Name>strNameSpc</Name> <Default/> </Parameter> <Note>Create a CDATA SECTION node directly under root.</Note> </Function> <Function id="20"> <Name>_XMLCreateComment</Name> <Parameter id="1"> <Name>strNode</Name> </Parameter> <Parameter id="2"> <Name>strComment</Name> </Parameter> <Note>Create a COMMENT node at specified path.</Note> </Function> <Function id="21"> <Name>_XMLCreateAttrib</Name> ( strXPath,,="" ) <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Parameter id="2"> <Name>strAttrName</Name> </Parameter> <Parameter id="3"> <Name>strAttrValue</Name> <Default/> </Parameter> <Note>Creates an attribute for the specified node.</Note> </Function> <Function id="22"> <Name>_XMLCreateRootChild</Name> <Parameter id="1"> <Name>strNode</Name> </Parameter> <Parameter id="2"> <Name>strData</Name> <Default/> </Parameter> <Parameter id="3"> <Name>strNameSpc</Name> <Default/> </Parameter> <Note>Create node directly under root.</Note> </Function> <Function id="23"> <Name>_XMLCreateRootNodeWAttr</Name> <Parameter id="1"> <Name>strNode</Name> </Parameter> <Parameter id="2"> <Name>aAttr</Name> </Parameter> <Parameter id="3"> <Name>aVal</Name> </Parameter> <Parameter id="4"> <Name>strData</Name> <Default/> </Parameter> <Parameter id="5"> <Name>strNameSpc</Name> <Default/> </Parameter> <Note>Create a child node under root node with attributes.</Note> </Function> <Function id="24"> <Name>_XMLCreateChildNode</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Parameter id="2"> <Name>strNode</Name> </Parameter> <Parameter id="3"> <Name>strData</Name> <Default/> </Parameter> <Parameter id="4"> <Name>strNameSpc</Name> <Default/> </Parameter> <Note>Create a child node under the specified XPath Node.</Note> </Function> <Function id="25"> <Name>_XMLCreateChildWAttr</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Parameter id="2"> <Name>strNode</Name> </Parameter> <Parameter id="3"> <Name>aAttr</Name> </Parameter> <Parameter id="4"> <Name>aVal</Name> </Parameter> <Parameter id="5"> <Name>strData</Name> <Default/> </Parameter> <Parameter id="6"> <Name>strNameSpc</Name> <Default/> </Parameter> <Note>Create a child node under the specified XPath Node with Attributes.</Note> </Function> <Function id="26"> <Name>_XMLSchemaValidate</Name> <Parameter id="1"> <Name>sXMLFile</Name> </Parameter> <Parameter id="2"> <Name>ns</Name> </Parameter> <Parameter id="3"> <Name>sXSDFile</Name> </Parameter> <Note>Validate a document against a DTD.</Note> </Function> <Function id="27"> <Name>_XMLGetDomVersion</Name> <Note>Returns the XSXML version currently in use.</Note> </Function> <Function id="28"> <Name>_XMLError</Name> <Parameter id="1"> <Name>sError</Name> <Default/> </Parameter> <Note>Sets or Gets XML error message generated by XML functions.</Note> </Function> <Function id="29"> <Name>_XMLUDFVersion</Name> <Note>Returns the UDF Version number.</Note> </Function> <Function id="30"> <Name>_XMLTransform</Name> <Parameter id="1"> <Name>oXMLDoc</Name> <Default/> <Reference></Reference> </Parameter> <Parameter id="2"> <Name>Style</Name> <Default/> </Parameter> <Parameter id="3"> <Name>szNewDoc</Name> <Default/> </Parameter> <Note>Transfroms the document using built-in sheet or xsl file passed to function.</Note> </Function> <Function id="31"> <Name>_XMLNodeExists</Name> <Parameter id="1"> <Name>strXPath</Name> </Parameter> <Note>Checks for the existence of the specified path.</Note> </Function> </File> </Project>oÝ÷ Ø ÝêÞËayË«éí*kzÛrnº$zw(u殶sb6æ6ÇVFRfÇCµõÔÄFöÕw&W"æS2fwC°¢6æ6ÇVFRfÇC´ÖöFW&äÖVçU&ræS2fwC° ¤÷Bb33µG&ÖVçTÖöFRb33²Â²FVfVÇBG&ÖVçRFV×267&BW6VBôWBvÆÂæ÷B&R6÷vâà¤÷Bb33µG&öäWfVçDÖöFRb33²Â²6ævRFòöäWfVçBÖöFP¤÷Bb33´uTöäWfVçDÖöFRb33²Â²6ævRFòöäWfVçBÖöFP ¢4æõG&6öâ²FRFR6öâVçFÂ6WB×÷vâà ¤¶ÆÄ7W'&VçB²¶ÆÂBbBb33·2Ç&VG'VææærÒD22dõ"DU5Däp¤gVæ2¶ÆÄ7W'&VçB¢Æö6Âb33c¶×vâÒb33·G$6ÆVçBb33°¢bväW7G2b33c¶×vâFVâvä¶ÆÂb33c¶×vâ¢WFôEvå6WEFFÆRb33c¶×vâ¤VæDgVæ0 ¥õ6WEG&&´6öÆ÷"dd##¥õ6WEG&6öä&´6öÆ÷"$#sr¥õ6WEG&6VÆV7D&´6öÆ÷"cc###"¥õ6WEG&6VÆV7E&V7D6öÆ÷"CCst¥õ6WEG&6VÆV7EFWD6öÆ÷"cddddb¥õ6WEG&FWD6öÆ÷" ¤vÆö&Âb33cµG&6öâÒõG&6öä7&VFRb33·G$b33²ÂgV÷C·6VÆÃ3"æFÆÂgV÷C²Â#BÂb33µG&6ÆÄ&6²b33²¥õG&6öå6WD6Æ6²b33cµG&6öâÂb¥õG&6öå6WE7FFRb33cµG&6öâ²6÷rFRG&6öà ¤'VÆDÖVçR¥vÆR¢6ÆVW#S²æöBöfbf÷"&Bà¥vVæB ¤gVæ2'VÆDÖVçR¢Æö6Âb33c·4fÆRÒ67&DF"fײgV÷C²b3#¶FVfæFöâçÖÂgV÷C°¢bfÆTW7G2b33c·4fÆRFVà¢Æö6Âb33c·&WBÒõÔÄfÆT÷Vâb33c·4fÆR¢bb33c·&WBÓFVâW@ ¢FÒb33c¶æÖU³ÒÂb33c¶fųР¢Æö6Âb33c´fÆT6÷VçBÂb33c´gVæ46÷VçBÂb33cµf'46÷VçBÂb33c¶Âb33c¶¢Âb33c¶°¢Æö6Âb33c´gVæ4æÖRÂb33cµf$æÖRÂb33cµf$FfÇBÂb33cµf%&Vb ¢b33c´fÆT6÷VçBÒõÔÄvWDæöFT6÷VçBb33²õ&ö¦V7BôfÆRb33²¢FÒb33c´fÆTÖVçU²b33c¶fÆV6÷VçEТFÒb33c´fÆT6öå²b33c¶fÆV6÷VçEÐ ¢f÷"b33c¶ÒFòb33c¶fÆV6÷Vç@¢b33c¶fÆRÒôvWDf'7EfÇVRb33²õ&ö¦V7BôfÆU´CÒb33²fײb33c¶fײb33µÒôæÖRb33²¢b33c¶fÆRÒ7G&æu7ÆBb33c¶fÆRÂgV÷C²b3#²gV÷C²Â¢b33c¶fÆRÒb33c¶fÆU²b33c¶fÆU³ÕÐ ¢b33c´fÆTÖVçU²b33c¶ÒÒÒõG&7&VFTÖVçRb33cµG&6öâÂb33c¶fÆR¢b33c´fÆT6öå²b33c¶ÒÒÒõG&FVÕ6WD6öâb33c´fÆTÖVçU²b33c¶ÒÒÂgV÷C·6VÆÃ3"æFÆÂgV÷C²ÂB ¢b33c´gVæ46÷VçBÒõÔÄvWDæöFT6÷VçBb33²õ&ö¦V7BôfÆU´CÒb33²fײb33c¶fײb33µÒôgVæ7Föâb33²¢FÒb33c´gVæ4ÖVçU²b33c´gVæ46÷VçEТFÒb33c´gVæ46öå²b33c´gVæ46÷VçEÐ ¢f÷"b33c¶¢ÒFòb33c´gVæ46÷Vç@¢b33cµf'46÷VçBÒõÔÄvWDæöFT6÷VçBb33²õ&ö¦V7BôfÆU´CÒb33²fײb33c¶fײb33µÒôgVæ7Föå´CÒb33²fײb33c¶¢fײb33µÒõ&ÖWFW"b33² ¢b33c´gVæ4æÖRÒôvWDf'7EfÇVRb33²õ&ö¦V7BôfÆU´CÒb33²fײb33c¶fײb33µÒôgVæ7Föå´CÒb33²fײb33c¶¢fײb33µÒôæÖRb33² ¢bb33cµf'46÷VçBfwC²FVâ¢b33c´gVæ4ÖVçU²b33c¶¢ÒÒÒõG&7&VFTÖVçRb33c´fÆT6öå²b33c¶ÒÒÂb33c´gVæ4æÖRÂb33c´fÆTÖVçU²b33c¶ÒÒ¢b33c´gVæ46öå²b33c¶¢ÒÒÒõG&FVÕ6WD6öâb33c´gVæ4ÖVçU²b33c¶¢ÒÒÂgV÷C·6VÆÃ3"æFÆÂgV÷C²Â" ¢FÒb33cµf'4ÖVçU²b33cµf'46÷VçEТFÒb33cµf'46öå²b33cµf'46÷VçEÐ ¢f÷"b33c¶²ÒFòb33cµf'46÷Vç@¢b33cµf$æÖRÒôvWDf'7EfÇVRb33²õ&ö¦V7BôfÆU´CÒb33²fײb33c¶fײb33µÒôgVæ7Föå´CÒb33²fײb33c¶¢fײb33µÒõ&ÖWFW%´CÒb33²fײb33c¶²fײb33µÒôæÖRb33²¢b33cµf$FfÇBÒôvWDf'7EfÇVRb33²õ&ö¦V7BôfÆU´CÒb33²fײb33c¶fײb33µÒôgVæ7Föå´CÒb33²fײb33c¶¢fײb33µÒõ&ÖWFW%´CÒb33²fײb33c¶²fײb33µÒôFVfVÇBb33²¢b33cµf%&VbÒôvWDf'7EfÇVRb33²õ&ö¦V7BôfÆU´CÒb33²fײb33c¶fײb33µÒôgVæ7Föå´CÒb33²fײb33c¶¢fײb33µÒõ&ÖWFW%´CÒb33²fײb33c¶²fײb33µÒõ&VfW&Væ6Rb33² ¢b33cµf'4ÖVçU²b33c¶²ÒÒÒõG&7&VFTFVÒb33c´gVæ46öå²b33c¶¢ÒÒÂb33cµf$æÖRÂb33c´gVæ4ÖVçU²b33c¶¢ÒÒ¢b33cµf'46öå²b33c¶²ÒÒÒõG&FVÕ6WD6öâb33cµf'4ÖVçU²b33c¶²ÒÒÂgV÷C·6VÆÃ3"æFÆÂgV÷C²ÂR¢æWB¢VÇ6P¢b33c´gVæ4ÖVçU²b33c¶¢ÒÒÒõG&7&VFTFVÒb33c´fÆT6öå²b33c¶ÒÒÂb33c´gVæ4æÖRÂb33c´fÆTÖVçU²b33c¶ÒÒ¢b33c´gVæ46öå²b33c¶¢ÒÒÒõG&FVÕ6WD6öâb33c´gVæ4ÖVçU²b33c¶¢ÒÒÂgV÷C·6VÆÃ3"æFÆÂgV÷C²Â2 ¢VæD` ¢uT7G&Å6WDöäWfVçBb33c´gVæ4ÖVçU²b33c¶¢ÒÒÂb33´æ÷FRb33²²F2âb33·BW7FÇv÷&¶ærFÒÂ6÷VÆB&RFVÂ'&V¶W"à¢æWB¢æWB ¢G&tÆæRb33cµG&6öâ ¢Æö6Âb33c·FWBÒõG&7&VFTFVÒb33cµG&6öâÂb33´WBb33²¢Æö6Âb33c¶WBÒõG&FVÕ6WD6öâb33c·FWBÂgV÷C·6VÆÃ3"æFÆÂgV÷C²Â#¢uT7G&Å6WDöäWfVçBb33c·FWBÂb33´WDb33² ¢&WGW&â¢VæD`¢&WGW&â¤VæDgVæ2³ÓÒfwC´ÆöE6WGFæw0 ¤gVæ2WD¢õG&6öäFVÆWFRb33cµG&6öâ¢WB¤VæDgVæ0 ¤gVæ2G&tÆæRb33c¶6öâ¢õG&7&VFTFVÒb33c¶6öâÂgV÷C²gV÷C²¢õG&FVÕ6WD6öâÓÂgV÷C²gV÷C²Â¤VæDgVæ0 ¤gVæ2æ÷FR¢×6v&÷#c#CBÂb33²b33²ÄuTô5E$ÄB¤VæDgVæ0 £´vWBFRf'7B&VÂfÇVR&WGW&æVBg&öÒFRõÔÄvWEfÇVR&WGW&â'&à¤gVæ2ôvWDf'7EfÇVRb33c¶æöFR b33c·&WE÷fÂÒõÔÄvWEfÇVRb33c¶æöFR b4'&b33c·&WE÷fÂFVà &WGW&âb33c·&WE÷fÅ³Ò VÇ6P &WGW&â6WDW'&÷"Ã2à VæD`¤VæDgVæ0At the end of the day (more likely the week), I'd like this to be able to show 'notes' when appropriate, and also show a function 'prototype', that you can copy to the windows clipboard for pasting into your favorite editor. It should also track return values, but they seem to be fairly hard to grab via a parser.All comments, suggestions, improvements welcome. Feel free to stop by just to tell me I'm crazy for doing this. It won't be my first time. Search AutoItScript.com via Google 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