Jump to content

Passing an Array to an included Script?


Damein
 Share

Recommended Posts

Hey, so I'm trying to use I guess a Global Array? Dunno if this is possible but I want to be able to fill the array in one script and then pass it to another with the same values.

 

I think I could do this by first assigning all the values of the array to a string using the ArrayToString and then converting it back but I wanted to first check if there isn't a clean way to just pass an array to an include.

 

Thanks!

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

You stated it's an 'include'.  I'm assuming that means that one script "#include"'s another.

Your included script can contain function, and your driving script that includes it can call the function, and pass the array as a parameter to it.

; script one...
#include "Script2.au3"
Local $a[5]=[1,2,3,4,5]
Script2Func($a)


; script two...named script2.au3
Func Script2Func($aCallersData)
    For $i = 0 To UBound($aCallersData)-1
        ConsoleWrite($aCallersData[$i] & @CRLF)
    Next
EndFunc

 

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

That'll do just fine :)

 

I saw the ByRef earlier in my searches but didn't know if it would be the cleanest way or not.

 

Thanks!

MCR.jpg?t=1286371579

Most recent sig. I made

Quick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic

Link to comment
Share on other sites

Depends if you function does heavy lifting with modifying the array or not.  I suppose to be the most efficient you would use byref...if your arrays are super small, then it won't matter.

IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...