Sign in to follow this  
Followers 0
Fly By Night

Defining Null Arrays

5 posts in this topic

#1 ·  Posted (edited)

In all my years dabbling with AutoItScript, i've never figured this out.

How do you define a null array?

Is $clipQ[1] = [""] considered a null array? I've tried $clipQ = "" but when you try to do array operations on it, they seem to fail.

With the _ArrayPop function,

If the array has one element left, it will be set to "" after _ArrayPop() is used on it.

What is that setting the array too as you can't display the array using _ArrayDisplay anymore. Is is going back to setting the array as an empty string as when i try to do an _ArrayAdd after it's popped the last item, this doesn't work? How do you get around that?

Thanks for any info to clear this for me.

Edited by Fly By Night

Share this post


Link to post
Share on other sites



Fly By Night,

You cannot have a NULL array in AutoIt - you must have at least 1 element. So when you _ArrayPop the final element, you no longer have an array - just a normal (but empty) variable. :mellow:

If you want to know more, I suggest reading this thread. :)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______My UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Fly By Night,

You cannot have a NULL array in AutoIt - you must have at least 1 element. So when you _ArrayPop the final element, you no longer have an array - just a normal (but empty) variable. :mellow:

If you want to know more, I suggest reading this thread. :)

M23

Cheers. Now i know why i've never managed to figured out how to have an empty array...lol. Just never asked about it and made workarounds.

Just trying to make a queue and sometimes it will be empty. Will just have to have a dummy entry in to keep array alive i guess.

Thanks again.

Edited by Fly By Night

Share this post


Link to post
Share on other sites

Just trying to make a queue and sometimes it will be empty. Will just have to have a dummy entry in to keep array alive i guess.

Why? Just use IsArray($x) instead of something like IsArrayEmpty($x) and you can implement your empty array without problems :mellow:

PS: To create a queue, I prefer a circular buffer if you can accept a limited quoue length.


*GERMAN* [note: you are not allowed to remove author / modified info from my UDFs]My UDFs:[_SetImageBinaryToCtrl] [_TaskDialog] [AutoItObject] [Animated GIF (GDI+)] [ClipPut for Image] [FreeImage] [GDI32 UDFs] [GDIPlus Progressbar] [Hotkey-Selector] [Multiline Inputbox] [MySQL without ODBC] [RichEdit UDFs] [SpeechAPI Example] [WinHTTP]UDFs included in AutoIt: FTP_Ex (as FTPEx), _WinAPI_SetLayeredWindowAttributes

Share this post


Link to post
Share on other sites

Cheers i just read the info at the thread pointed to by Melba23 so will go work on these techniques.

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0