kcvinu Posted February 26, 2015 Posted February 26, 2015 (edited) Hi all,Sometimes we need to know instantly what our array contains. For this, i have made a little function to print your array in console. You may use this function in MsgBox too.Here is the code.#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.12.0 Author: kcvinu Script Function: Sometimes we need to see what an array or a list contains. And this script will help you to see the all elements without a loop Example : If you have an array like this = Local $MyArray[4] = ['Red','Green','Blue','Yellow'] You need to use the fuction like this = PrintList($MyArray) Result : It will print your Array in Console like this [Red,Green,Blue,Yellow] Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here Func PrintList($List) If IsArray($List) Then Local $txt = "" For $i = 0 to UBound($List) -1 $txt = $txt & "," & $List[$i] Next Local $out = StringMid($txt,2) Global $Result = "[" & $out & "]" ConsoleWrite($Result) Return $Result Else MsgBox(0, "List Error", "Variable is not an array or a list") EndIf EndFunc ;==>PrintList PrintList.au3 Edited September 6, 2015 by kcvinu JohnOne 1 Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
TheSaint Posted February 26, 2015 Posted February 26, 2015 (edited) You are aware of the _ArrayDisplay command in the UDF section of the Help file? I don't wish to discourage you on your programming journey, but I suggest you read what I wrote >here. P.S. Nice to see you coming along with your programming though. Edited February 26, 2015 by TheSaint kcvinu 1 Make sure brain is in gear before opening mouth! Remember, what is not said, can be just as important as what is said. Spoiler What is the Secret Key? Life is like a Donut If I put effort into communication, I expect you to read properly & fully, or just not comment. Ignoring those who try to divert conversation with irrelevancies. If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it. I'm only big and bad, to those who have an over-active imagination. I may have the Artistic Liesense to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)
JohnOne Posted February 26, 2015 Posted February 26, 2015 Want to develop your PrintList idea for good coding practice? Make it print out in a uniform manner in rows and columns, which you could actually print via a printer. kcvinu 1 AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
water Posted February 26, 2015 Posted February 26, 2015 UEZ of the german forum has already created such an UDF to display the content of an array in a formated way on the console. It works pretty well kcvinu 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
JohnOne Posted February 26, 2015 Posted February 26, 2015 Well I'm sure the OP won't cheat and look at it, if he decides to go ahead AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
UEZ Posted February 26, 2015 Posted February 26, 2015 (edited) UEZ of the german forum has already created such an UDF to display the content of an array in a formated way on the console. It works pretty well It can be found here, too (also a version by gil900): Br, UEZ Edited February 26, 2015 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
Moderators Melba23 Posted February 26, 2015 Moderators Posted February 26, 2015 Hi,And you can even get _ArrayDisplay itself to nicely format the data when copied via the dialog buttons if you set the $vUser_Separator parameter to a numeric value:#include <Array.au3> Local $aArray[][] = [["Item 0-0", "Item 0-1"], ["Item 1-0", "Item 1-1"]] _ArrayDisplay($aArray, "Formatted", Default, Default, 10, "Column 1|Column 2")Run the script, press the either of the "Copy Data" buttons and paste into the SciTE console to see what I mean. M23 kcvinu 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area
kcvinu Posted February 26, 2015 Author Posted February 26, 2015 Hi all, I have read your valubale comments. And I have tested the _ArrayDisplay function. I think my function is different from that. Anyway, thanks to those who supported me. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
water Posted February 26, 2015 Posted February 26, 2015 I think you should compare your function with the UDF written by UEZ. Both write the content of the array to the console. kcvinu 1 My UDFs and Tutorials: Spoiler UDFs: Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs: Excel - Example Scripts - Wiki Word - Wiki Tutorials: ADO - Wiki WebDriver - Wiki
kcvinu Posted February 27, 2015 Author Posted February 27, 2015 Hi water, Yes. Spoiler My Contributions Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language. UDF Link Viewer --- A tool to visit the links of some most important UDFs Includer_2 ----- A tool to type the #include statement automatically Digits To Date ----- date from 3 integer values PrintList ----- prints arrays into console for testing. Alert ------ An alternative for MsgBox MousePosition ------- A simple tooltip display of mouse position GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function Access_UDF -------- An UDF for working with access database files. (.*accdb only)
spudw2k Posted March 5, 2015 Posted March 5, 2015 I made a not so simple, but fairly elegant function to enumerate any size array which also write the contents to the console. It is in the spoiler section of this post: It was just a fun exercise. I can't think of any application/purpose where I would need an array with more than 3 dimensions (I find 2-dimensions to be adequate most of the time), but I wanted to make the func dynamic enough to support whatever I threw at it. kcvinu 1 Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX Builder Misc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retrieve SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose Array Projects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalc Cool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF
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