RoscoeT Posted January 14, 2009 Posted January 14, 2009 Hello Board, I just started to code some scripts with Autoit last night for the first time. I am pretty good at scripting in general with lots of PHP experience. Searched google and the help files and not found what I am looking for so I am asking for help or a pointer to a specific doc. If I have a function that returns a Collection how can I get information about the valid elements in that collection? Similar to the print_r() function in PHP or maybe the array_keys() function. For example in the code below from examples I've seen, I know that $oLink.href is a valid "property" for each element in the $oLinks collection. But how could I see what other "property" names are valid? I know that many of the functions that return collections have some documentation. But suppose you needed to test it or had an undcoumented User Defined Function, how could you find this? $oLinks = _IELinkGetCollection ($oIE) $iNumLinks = @extended $GetHandle = WinGetHandle("Windows Internet Explorer") WinSetState($GetHandle, "", @SW_MAXIMIZE) For $oLink In $oLinks ; NEED HELP HERE.... NEXT Much thanks in advance for any tips or help. R
Das Ami Posted January 14, 2009 Posted January 14, 2009 (edited) I don't know if it helps but you could try something like this. $oLinks = _IELinkGetCollection ($oIE) $iNumLinks = @extended $linkEl="" $GetHandle = WinGetHandle("Windows Internet Explorer") WinSetState($GetHandle, "", @SW_MAXIMIZE) For $oLink In $oLinks If IsDeclared($oLink.href) Then $linkEl=$linkEl&"href: "&$oLink.href&@CRLF If IsDeclared($oLink.name) Then $linkEl=$linkEl&"name: "&$oLink.name&@CRLF ;...and so on Msgbox(0, "Elements of Link "&$oLink, $linkEl) Next Edited January 14, 2009 by Das Ami
azure Posted January 14, 2009 Posted January 14, 2009 I don't know if it helps but you could try something like this.I think what he's asking is how to find all the properties of the members of a collection if it's not documented.
RoscoeT Posted January 14, 2009 Author Posted January 14, 2009 I don't know if it helps but you could try something like this. $oLinks = _IELinkGetCollection ($oIE) $iNumLinks = @extended $linkEl="" $GetHandle = WinGetHandle("Windows Internet Explorer") WinSetState($GetHandle, "", @SW_MAXIMIZE) For $oLink In $oLinks If IsDeclared($oLink.href) Then $linkEl=$linkEl&"href: "&$oLink.href&@CRLF If IsDeclared($oLink.name) Then $linkEl=$linkEl&"name: "&$oLink.name&@CRLF ;...and so on Msgbox(0, "Elements of Link "&$oLink, $linkEl) Next Thanks for the reply, I guess what I am asking is... If you did not know that $oLink.name was called $oLink.name how would you know to check it with IsDeclared() ? We know that $oLink has "properties" (unsure of the proper name) called "href" and "name" and various others. But were is that documented? And if its not documented how can you probe $oLInk to get the names of all its properties? R
Das Ami Posted January 14, 2009 Posted January 14, 2009 (edited) We know that $oLink has "properties" (unsure of the proper name) called "href" and "name" and various others. But were is that documented?They are called attributes, hope this helps. Edited January 14, 2009 by Das Ami
azure Posted January 14, 2009 Posted January 14, 2009 They are called elements, hope this helps.Well.. yeah.. but that's not what he's asking. Elements are the HTML stuff... what if other things return collections in autoit. I know in Powershell there are commands to probe for properties and methods of an object. Is there something equivalent in autoit?(I'm curious now too).
RoscoeT Posted January 14, 2009 Author Posted January 14, 2009 Well.. yeah.. but that's not what he's asking. Elements are the HTML stuff... what if other things return collections in autoit. I know in Powershell there are commands to probe for properties and methods of an object. Is there something equivalent in autoit?(I'm curious now too).Yes, exactly. Thanks, can anyone answer this?
BrettF Posted January 15, 2009 Posted January 15, 2009 (edited) What is the page, or an example of what you are trying to search and trying to find? If I understand what you want, you may just have to parse the page. Cheers, Brett EDIT: Also, please limit bumping to a 24 hour period. Edited January 15, 2009 by BrettF Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version!
RoscoeT Posted January 15, 2009 Author Posted January 15, 2009 What is the page, or an example of what you are trying to search and trying to find? If I understand what you want, you may just have to parse the page.Cheers,BrettEDIT:Also, please limit bumping to a 24 hour period.Hi,All I am trying to do is figure out how to determine what methods and properties an any object contains.If I have a function, for example _IELinkGetCollection, that returns a collection of objects how can I know the valid properties and methods of each collection member?In PHP it's print_r() or array_keys()In the above example I know, from user examples that an object returned by _IELinkGetCollection() has the property href. But if I did not know that, how could I ever figure that out?That is just an example for one object. How can I figure it out for any object? Not just that function. This is a general language problem and not specific to one piece of code.Thanks,R
RoscoeT Posted January 15, 2009 Author Posted January 15, 2009 I found one thing that helps for arrays The _ArrayDisplay() function works pretty well. I would like to see something similar for objects and collections.
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