Jump to content
Sign in to follow this  
EdDyreen

Pointer to Array

Recommended Posts

EdDyreen

Dim $Array[6] = [                        _
    '$File_SCRIPT_Internal',             _
    '$FileName_SCRIPT_Internal',         _
    '$FileExtension_SCRIPT_Internal',    _
    '$File_SCRIPT_External',             _
    '$FileName_SCRIPT_External',         _
    '$FileExtension_SCRIPT_External'     _
]

$NameofArray = 'Array'

_ArrayDisplay ( $NameofArray )
Exit

not working

tried eval ()

tried string ()

can I do it with a pointer ?

How does that work ?


• Any number images • Images of any size • Any number of URLs • Any number of lines

Share this post


Link to post
Share on other sites
jvanegmond

It works fine with eval:

#include <Array.au3>

Dim $Array[6] = [                        _
    '$File_SCRIPT_Internal',             _
    '$FileName_SCRIPT_Internal',         _
    '$FileExtension_SCRIPT_Internal',    _
    '$File_SCRIPT_External',             _
    '$FileName_SCRIPT_External',         _
    '$FileExtension_SCRIPT_External'     _
]

$NameofArray = Eval('Array')

_ArrayDisplay ( $NameofArray )
Exit

Share this post


Link to post
Share on other sites
Melba23

EdDyreen,

As Manadar has shown, you need to get the Eval function out of the way first as _ArrayDisplay MUST have a Const ByRef parameter as the array name. You can see this from the error you get when you put the Eval inside the _ArrayDisplay:

ERROR: _ArrayDisplay() called with expression on Const ByRef-param(s)

So you have to do the Eval bit first.

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
EdDyreen

EdDyreen,

As Manadar has shown, you need to get the Eval function out of the way first as _ArrayDisplay MUST have a Const ByRef parameter as the array name. You can see this from the error you get when you put the Eval inside the _ArrayDisplay:

ERROR: _ArrayDisplay() called with expression on Const ByRef-param(s)

So you have to do the Eval bit first.

M23

Thnx, stupid me, I was doing: _ArrayDisplay ( Eval( $NameofArray) )

but i get a different error:

Dim $Array[6] = [                        _
    '$File_SCRIPT_Internal',             _
    '$FileName_SCRIPT_Internal',         _
    '$FileExtension_SCRIPT_Internal',    _
    '$File_SCRIPT_External',             _
    '$FileName_SCRIPT_External',         _
    '$FileExtension_SCRIPT_External'     _
]

$NameofArray = 'Array'
_ArrayDisplay ( Eval( $NameofArray) )
Exit

F:\TST.au3 (205) : ==> Expected a variable in user function call.:

_ArrayDisplay ( Eval( $NameofArray) )

_ArrayDisplay ( ^ ERROR

Anyway it works now :D


• Any number images • Images of any size • Any number of URLs • Any number of lines

Share this post


Link to post
Share on other sites
PsaltyDS

There was a tweak to allow values returned from nested functions to be used ByRef in other functions. This works if you click Continue on the syntax check error:

#include <Array.au3>

Global $sString = "ABCDEF"
_ArrayDisplay(StringSplit($sString, ""))

However, in Beta 3.3.3.3 and below, this didn't work with Eval():

#include <Array.au3>

Global $sString = "ABCDEF"
Global $aArray = StringSplit($sString, "")
_ArrayDisplay(Eval("aArray"))

Update to the current 3.3.4.0 Prod version and the above script also works (again, after clicking Continue on a syntax error).

Getting rid of the syntax error report is an AU3Check.exe tweak, I think.

:D

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Melba23

PsaltyDS,

Another day - another little nugget of information.

Not sure I will ever use it, but thanks for letting us know! :D

M23

Edit: Speeling (or rather tpying!)

Edited by Melba23

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
jchd

@PsaltyDS: thanks for sharing.

I was completely unaware of the issue as I only save my source files in UTF-8 + BOM encoding, and Au3Check doesn't know how to cook UTF files.

Geez, if that breaks down in a future version, I'll have myriads of such nested calls to unroll.

@Devs: Is there any assurance that such nested calls will keep on working as per 3.3.4.0?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
MvGulik
whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

Share this post


Link to post
Share on other sites
PsaltyDS

When I mentioned another tweak to AU3Check to Jos, he channeled his inner Elmer Fudd: "Shhhh! Be vewy quiet, I'm hunting pengwins! Huh-uh-uh-uh-uh-uh-uh-uh"

:D

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
Melba23

PsaltyDS,

I never realised rakishly good-looking water fowl were so endangered! :D

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
MvGulik
whatever Edited by MvGulik

"Straight_and_Crooked_Thinking" : A "classic guide to ferreting out untruths, half-truths, and other distortions of facts in political and social discussions."
"The Secrets of Quantum Physics" : New and excellent 2 part documentary on Quantum Physics by Jim Al-Khalili. (Dec 2014)

"Believing what you know ain't so" ...

Knock Knock ...
 

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  

×