rdr Posted September 10, 2013 Share Posted September 10, 2013 Hello, I need to make a call to a method that takes as a parameter a variant that should be an array of properties. For the specific function that I need to be executed, there are no needed properties, so I would need to pass an empty array. In VB I would just use the Array() constructor, but in AutoIt what can I use? Is there something equivalent? Thank you Link to comment Share on other sites More sharing options...
FireFox Posted September 10, 2013 Share Posted September 10, 2013 Hi,Welcome to the autoit forum In the beta version you can create empty arrays (e.g: $aArray[0]), I don't know if it's what you're looking for.Br, FireFox. Link to comment Share on other sites More sharing options...
water Posted September 10, 2013 Share Posted September 10, 2013 Welcome to AutoIt and the forum! You need the latest Beta version of AutoIt. There you can create an empty array. Global $aArray[] ConsoleWrite(UBound($aArray) & @LF) My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
FireFox Posted September 10, 2013 Share Posted September 10, 2013 (edited) @water,It's an empty table, not an empty array. Edited September 10, 2013 by FireFox Link to comment Share on other sites More sharing options...
water Posted September 10, 2013 Share Posted September 10, 2013 Opps, sorry Looks like I need to get my feet wet with the new features. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
Solution Mat Posted September 10, 2013 Solution Share Posted September 10, 2013 (edited) This does work though: Local $a = [] Edit: Though UBound($a) returns 1 for that. What firefox suggested (Local $a[0]) works. Edited September 10, 2013 by Mat AutoIt Project Listing Link to comment Share on other sites More sharing options...
water Posted September 10, 2013 Share Posted September 10, 2013 It's an array, but not an empty array. Global $aArray = [] ConsoleWrite(VarGetType($aArray) & @LF) ConsoleWrite(UBound($aArray, 1) & @LF) returns 1. Strange. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
rdr Posted September 10, 2013 Author Share Posted September 10, 2013 (edited) Thank you very much for your replies. I installed the Beta version and compiled the script again but unfortunately I am getting COM errors ('interface not registered' for $array[] and 'type mismatch' for $array = []). So, I am guessing there must be some small difference in the implementation of the empty table in autoit? EDIT: It turns out I was passing another parameter wrong and $array = [] did the job after all! Thank you very much again! Edited September 10, 2013 by rdr Link to comment Share on other sites More sharing options...
trancexx Posted September 10, 2013 Share Posted September 10, 2013 It's an array, but not an empty array. Global $aArray = [] ConsoleWrite(VarGetType($aArray) & @LF) ConsoleWrite(UBound($aArray, 1) & @LF) returns 1. Strange. It's not strange, it's opposite of that. Consistent with the syntax rules of AutoIt: #include <Array.au3> Local $aArray[5] = [1, 2] _ArrayDisplay($aArray) ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
water Posted September 10, 2013 Share Posted September 10, 2013 Seems I'm a bit slow on the uptake (today). Why does UBound($aArray4) return 1? Shouldn't it be 0? Global $aArray1[0], $aArray2[1], $aArray3 = [1], $aArray4 = [] ConsoleWrite("UBound($aArray1, 1): " & UBound($aArray1, 1) & @LF) ConsoleWrite("UBound($aArray2, 1): " & UBound($aArray2, 1) & @LF) ConsoleWrite("UBound($aArray3, 1): " & UBound($aArray3, 1) & @LF) ConsoleWrite("UBound($aArray4, 1): " & UBound($aArray4, 1) & @LF) >Running:(3.3.9.19):C:\Program Files (x86)\AutoIt3\Beta\autoit3.exe "C:TempTest.au3" --> Press Ctrl+Alt+F5 to Restart or Ctrl+Break to Stop UBound($aArray1): 0 UBound($aArray2): 1 UBound($aArray3): 1 UBound($aArray4): 1 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
trancexx Posted September 10, 2013 Share Posted September 10, 2013 Because array4 has one element - an empty string, because AutoIt doesn't know for "nothing", it always has to be something. Array literal implies "something". You may not see the obvious on that simple example, but for more complex ones (multidimensional arrays literals) it will be clear, only your head might hurt at first. jchd can explain better, he's good with words. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
Mat Posted September 10, 2013 Share Posted September 10, 2013 [] = [""] So there is no such thing as an empty array literal then? AutoIt Project Listing Link to comment Share on other sites More sharing options...
FireFox Posted September 10, 2013 Share Posted September 10, 2013 [] = [Null] maybe. Link to comment Share on other sites More sharing options...
trancexx Posted September 10, 2013 Share Posted September 10, 2013 [] = [""]In current language implementation yes. Tomorrow it may be something else. If you leave AutoIt to fill unspecified elements then AutoIt will always use what's "nothing" to it.So there is no such thing as an empty array literal then?No. And yes. But no. ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
trancexx Posted September 10, 2013 Share Posted September 10, 2013 It's clear what this is: Local $aArray = [[]] Right? Or this maybe: Local $aArray = [[[[]]]] ♡♡♡ . eMyvnE Link to comment Share on other sites More sharing options...
water Posted September 10, 2013 Share Posted September 10, 2013 Now it's clear, thanks. I still prefer to define 2 or 4-dimensional arrays the "traditional" way My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
trancexx Posted September 10, 2013 Share Posted September 10, 2013 I do too.I also think that the language shuldn't, just because of that, have (unlogical) boundaries that would restrict users from prefering something else.Lifted boundaries give new possibilites even for us. ♡♡♡ . eMyvnE 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