Sign in to follow this  
Followers 0
NDog

declare variable from existing variable

11 posts in this topic

#1 ·  Posted (edited)

Hi All

I want to declare a variable using the value of an existing variable. In batch this can be done this simply.

eg.cmd

set count=123
set _var%count%=%count%
echo %_var123%

>_var123=123

How could I do such thing in autoit?

eg.au3

$count="123"
$_var$count=$count
consolewrite($_var123)

>==> No variable given for "Dim", "Local", "Global", "Struct" or "Const" statement.:

Thanks

Edited by NDog

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I don't understand why! But look at Eval and Assign, this might help (haven't tested as I don't use these functions that much.)

It can't be done.

Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

You would do it this way.

$count = "123"
Assign("_var" & $count, $count)
ConsoleWrite(Eval("_Var123") & @CRLF)

EDIT: Misread what the OP was attempting to do.

Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

This is as close as you will get if you want to call the variable $vVar123 without Eval.

Local $iCount = '123', $vVar123 = ''
Assign('vVar' & $iCount, $iCount, 1)
ConsoleWrite($vVar123 & @CRLF)

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Great thanks guiness!

now you will love my next question related to this.

How would I then compare part of the string of the variable name itself to another string, eg in batch again

eg.cmd

@echo off
set _var123=a string
for /f "usebackq tokens=1-2* delims=_=" %%g in (`set _var 2^>nul`) do (echo %%g &echo %%h)
pause

%%g = _var123 (the variable name itself which can be string compared etc)

%%h = a string (the data)

The %%g part (variable name) is able to be compared for further processing eg. stringsplit

eg.au3

?

Sorry if this flies in the face of all programming convention. In the meantime I will try to come up with something.

Edited by NDog

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

You could use a 2-dim array to hold key-value pairs as autoit is not natively able to use associative arrays.

Anyway I don't think that names of variables should be used as a container for data. :)

Edit:

Use a 1-dim array if your keys are just integer numbers:

Dim $vars[3] = [1, 2, 3]
$count = 2
$vars[$count] = $count
ConsoleWrite($var[$count] & @LF)
Edited by hannes08

Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler]

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Batch scripting is a little different to that of programming with AutoIt. Think of the difference here 'set' is creating a temporary environment string, whereas in AutoIt you create a variable name to point to a block of memory**.

** - In it's simplest form.

Edited by guinness

_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

I may post another topic but thanks for the help

My logic for doing this way

I have x amount of input boxes which I could type a name

While the script is running I can type a name in an input box. I then click something else which brings a menu, tick some boxes, OK. That will associate those ticked values to that name.

If I then go and change the name in the input box. I click something else which brings a menu - it should forget those values. But if I rename it back the original name, it should remember those values.

Thats where I got the idea to just use the variable name itself as the storage of the values, if that makes sense

Hope it explains

Share this post


Link to post
Share on other sites

I'm thinking an array (as hannes08 suggested) would be a better option and easier, if you understand how arrays work.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I have the problem that I am already setting an array with array values. is it possible to store an array within an array?

My autoit script function is to save/load a text file like this. It gets read by a batch file later so the formatting needs to remain as it is.

_admin_0_customscript_1=outlook_lyanne_7_mod.reg
_admin_0_customscript_2=RemoveTakeOwnership.reg
_admin_0_customscript_3=ieproxytimeout.reg
_admin_0_customscript_4=kill_lan_profiles.reg
_admin_0_customscript_5=renamelan.vbs
_admin_0_customscript_6=adminauto.cmd
_admin_0_customscript_7=allnew.cmd
_admin_0_customscript_8=create_lnk.cmd
_admin_0_customscript_9=del_usb_crap.cmd
_admin_0_customscript_10=Install_WPI.cmd
_admin_0_customscript_11=offlinefiles.cmd
_admin_0_customscript_12=QL.cmd
_admin_0_customscript_13=remadminauto.cmd
_admin_0_customscript_14=restartsysaidservice.cmd
_admin_0_customscript_15=smartmove.cmd
_admin_0_customscript_16=syncsoftware.cmd
_admin_0_customscript_17=test_internet.cmd
_admin_1_customscript_1=xp64tweak.reg
_admin_1_customscript_2=ieproxytimeout.reg
_admin_1_customscript_3=InstallTakeOwnership.reg
_admin_1_customscript_4=kill_lan_profiles.reg
_admin_1_customscript_5=win7ent_sysprep.vbs
_admin_1_customscript_6=win7pro_sysprep.vbs
_admin_1_customscript_7=cow_off_IE_password.cmd
_admin_1_customscript_8=offlinefiles.cmd
_admin_1_customscript_9=QL.cmd
_admin_1_customscript_10=restartsysaidservice.cmd
_limited_1_customscript_1=outlook_lyanne_7_mod.reg
_limited_1_customscript_2=RemoveTakeOwnership.reg
_limited_1_customscript_3=kill_lan_profiles.reg
_limited_1_customscript_4=renamelan.vbs
_limited_1_customscript_5=win7pro_sysprep.vbs
_limited_1_customscript_6=del_usb_crap.cmd
_limited_1_customscript_7=Install_WPI.cmd
_limited_1_customscript_8=offlinefiles.cmd
_limited_1_customscript_9=QL.cmd
_limited_1_customscript_10=remadminauto.cmd
_limited_1_customscript_11=rodneyDO.cmd

Now to read this text file back into autoit script and associate the values to each user eg ,admin0, admin1, limited1 I should have an array for each user no?

; a func which is pulling the text file and passing its values to the func so eg
customprofilescriptsmsgtoarray($CurrentSite, "admin"&$i,$file)
customprofilescriptsmsgtoarray($CurrentSite, "limited"&$i,$file)
; example
customprofilescriptsmsgtoarray("a folder", "admin0","filea.reg")
customprofilescriptsmsgtoarray("a folder", "admin0","fileb.reg")
customprofilescriptsmsgtoarray("a folder", "admin0","filec.reg")
customprofilescriptsmsgtoarray("a folder", "admin1","filea.cmd")
etc


; determine if the file exists, get file type, add to the correct column in the array
Func customprofilescriptsmsgtoarray($CurrentSite, $account ,$file)
    ; Need to get site name
    $customscriptsdir = @ScriptDir &"sites" & $CurrentSite & "customscripts"
    ;ConsoleWrite("Custom scripts folder: "&$customscriptsdir&@CRLF)

    If FileExists($customscriptsdir & "" & $file) Then
        $sExt = StringLower(stringmid($file,StringInStr($file,".",2,-1))) ; need to be lower case for comparison
        If $account = "admin0" Then
        ;_ArrayDisplay($arAdmincustomscripts0)
        ;ConsoleWrite("array x: " & UBound($arAdmincustomscripts0,1) & @CRLF)
            Select
                Case $sExt = ".reg"
                    If $arAdmincustomscripts0[UBound($arAdmincustomscripts0,1)-1][$filesreg] = "" Then
                        $arAdmincustomscripts0[UBound($arAdmincustomscripts0,1)-1][$filesreg] = $file
                    Else
                        ReDim $arAdmincustomscripts0[UBound($arAdmincustomscripts0,1)+1][$filesMAX]
                        $arAdmincustomscripts0[UBound($arAdmincustomscripts0,1)-1][$filesreg] = $file
                    EndIf
                Case $sExt = ".vbs"
                    If $arAdmincustomscripts0[UBound($arAdmincustomscripts0,1)-1][$filesvbs] = "" Then
                        $arAdmincustomscripts0[UBound($arAdmincustomscripts0,1)-1][$filesvbs] = $file
                    Else
                        ReDim $arAdmincustomscripts0[UBound($arAdmincustomscripts0,1)+1][$filesMAX]
                        $arAdmincustomscripts0[UBound($arAdmincustomscripts0,1)-1][$filesvbs] = $file
                    EndIf
                Case $sExt = ".cmd"
                    If $arAdmincustomscripts0[UBound($arAdmincustomscripts0,1)-1][$filescmd] = "" Then
                        $arAdmincustomscripts0[UBound($arAdmincustomscripts0,1)-1][$filescmd] = $file
                    Else
                        ReDim $arAdmincustomscripts0[UBound($arAdmincustomscripts0,1)+1][$filesMAX]
                        $arAdmincustomscripts0[UBound($arAdmincustomscripts0,1)-1][$filescmd] = $file
                    EndIf
            EndSelect
        ElseIf $account = "admin1" Then
            Select
                Case $sExt = ".reg"
                    If $arAdmincustomscripts1[UBound($arAdmincustomscripts1,1)-1][$filesreg] = "" Then
                        $arAdmincustomscripts1[UBound($arAdmincustomscripts1,1)-1][$filesreg] = $file
                    Else
                        ReDim $arAdmincustomscripts1[UBound($arAdmincustomscripts1,1)+1][$filesMAX]
                        $arAdmincustomscripts1[UBound($arAdmincustomscripts1,1)-1][$filesreg] = $file
                    EndIf
                Case $sExt = ".vbs"
                    If $arAdmincustomscripts1[UBound($arAdmincustomscripts1,1)-1][$filesvbs] = "" Then
                        $arAdmincustomscripts1[UBound($arAdmincustomscripts1,1)-1][$filesvbs] = $file
                    Else
                        ReDim $arAdmincustomscripts1[UBound($arAdmincustomscripts1,1)+1][$filesMAX]
                        $arAdmincustomscripts1[UBound($arAdmincustomscripts1,1)-1][$filesvbs] = $file
                    EndIf
                Case $sExt = ".cmd"
                    If $arAdmincustomscripts1[UBound($arAdmincustomscripts1,1)-1][$filescmd] = "" Then
                        $arAdmincustomscripts1[UBound($arAdmincustomscripts1,1)-1][$filescmd] = $file
                    Else
                        ReDim $arAdmincustomscripts1[UBound($arAdmincustomscripts1,1)+1][$filesMAX]
                        $arAdmincustomscripts1[UBound($arAdmincustomscripts1,1)-1][$filescmd] = $file
                    EndIf
            EndSelect
        ElseIf $account = "admin2" Then
            Select
                Case $sExt = ".reg"
                    If $arAdmincustomscripts2[UBound($arAdmincustomscripts2,1)-1][$filesreg] = "" Then
                        $arAdmincustomscripts2[UBound($arAdmincustomscripts2,1)-1][$filesreg] = $file
                    Else
                        ReDim $arAdmincustomscripts2[UBound($arAdmincustomscripts2,1)+1][$filesMAX]
                        $arAdmincustomscripts2[UBound($arAdmincustomscripts2,1)-1][$filesreg] = $file
                    EndIf
                Case $sExt = ".vbs"
                    If $arAdmincustomscripts2[UBound($arAdmincustomscripts2,1)-1][$filesvbs] = "" Then
                        $arAdmincustomscripts2[UBound($arAdmincustomscripts2,1)-1][$filesvbs] = $file
                    Else
                        ReDim $arAdmincustomscripts2[UBound($arAdmincustomscripts2,1)+1][$filesMAX]
                        $arAdmincustomscripts2[UBound($arAdmincustomscripts2,1)-1][$filesvbs] = $file
                    EndIf
                Case $sExt = ".cmd"
                    If $arAdmincustomscripts2[UBound($arAdmincustomscripts2,1)-1][$filescmd] = "" Then
                        $arAdmincustomscripts2[UBound($arAdmincustomscripts2,1)-1][$filescmd] = $file
                    Else
                        ReDim $arAdmincustomscripts2[UBound($arAdmincustomscripts2,1)+1][$filesMAX]
                        $arAdmincustomscripts2[UBound($arAdmincustomscripts2,1)-1][$filescmd] = $file
                    EndIf
            EndSelect
        
        ElseIf $account = "limited1" Then
            Select
                Case $sExt = ".reg"
                    If $arLimitedcustomscripts1[UBound($arLimitedcustomscripts1,1)-1][$filesreg] = "" Then
                        $arLimitedcustomscripts1[UBound($arLimitedcustomscripts1,1)-1][$filesreg] = $file
                    Else
                        ReDim $arLimitedcustomscripts1[UBound($arLimitedcustomscripts1,1)+1][$filesMAX]
                        $arLimitedcustomscripts1[UBound($arLimitedcustomscripts1,1)-1][$filesreg] = $file
                    EndIf
                Case $sExt = ".vbs"
                    If $arLimitedcustomscripts1[UBound($arLimitedcustomscripts1,1)-1][$filesvbs] = "" Then
                        $arLimitedcustomscripts1[UBound($arLimitedcustomscripts1,1)-1][$filesvbs] = $file
                    Else
                        ReDim $arLimitedcustomscripts1[UBound($arLimitedcustomscripts1,1)+1][$filesMAX]
                        $arLimitedcustomscripts1[UBound($arLimitedcustomscripts1,1)-1][$filesvbs] = $file
                    EndIf
                Case $sExt = ".cmd"
                    If $arLimitedcustomscripts1[UBound($arLimitedcustomscripts1,1)-1][$filescmd] = "" Then
                        $arLimitedcustomscripts1[UBound($arLimitedcustomscripts1,1)-1][$filescmd] = $file
                    Else
                        ReDim $arLimitedcustomscripts1[UBound($arLimitedcustomscripts1,1)+1][$filesMAX]
                        $arLimitedcustomscripts1[UBound($arLimitedcustomscripts1,1)-1][$filescmd] = $file
                    EndIf
            EndSelect
        ElseIf $account = "limited2" Then
            Select
                Case $sExt = ".reg"
                    If $arLimitedcustomscripts2[UBound($arLimitedcustomscripts2,1)-1][$filesreg] = "" Then
                        $arLimitedcustomscripts2[UBound($arLimitedcustomscripts2,1)-1][$filesreg] = $file
                    Else
                        ReDim $arLimitedcustomscripts2[UBound($arLimitedcustomscripts2,1)+1][$filesMAX]
                        $arLimitedcustomscripts2[UBound($arLimitedcustomscripts2,1)-1][$filesreg] = $file
                    EndIf
                Case $sExt = ".vbs"
                    If $arLimitedcustomscripts2[UBound($arLimitedcustomscripts2,1)-1][$filesvbs] = "" Then
                        $arLimitedcustomscripts2[UBound($arLimitedcustomscripts2,1)-1][$filesvbs] = $file
                    Else
                        ReDim $arLimitedcustomscripts2[UBound($arLimitedcustomscripts2,1)+1][$filesMAX]
                        $arLimitedcustomscripts2[UBound($arLimitedcustomscripts2,1)-1][$filesvbs] = $file
                    EndIf
                Case $sExt = ".cmd"
                    If $arLimitedcustomscripts2[UBound($arLimitedcustomscripts2,1)-1][$filescmd] = "" Then
                        $arLimitedcustomscripts2[UBound($arLimitedcustomscripts2,1)-1][$filescmd] = $file
                    Else
                        ReDim $arLimitedcustomscripts2[UBound($arLimitedcustomscripts2,1)+1][$filesMAX]
                        $arLimitedcustomscripts2[UBound($arLimitedcustomscripts2,1)-1][$filescmd] = $file
                    EndIf
            EndSelect
        ElseIf $account = "limited3" Then
            Select
                Case $sExt = ".reg"
                    If $arLimitedcustomscripts3[UBound($arLimitedcustomscripts3,1)-1][$filesreg] = "" Then
                        $arLimitedcustomscripts3[UBound($arLimitedcustomscripts3,1)-1][$filesreg] = $file
                    Else
                        ReDim $arLimitedcustomscripts3[UBound($arLimitedcustomscripts3,1)+1][$filesMAX]
                        $arLimitedcustomscripts3[UBound($arLimitedcustomscripts3,1)-1][$filesreg] = $file
                    EndIf
                Case $sExt = ".vbs"
                    If $arLimitedcustomscripts3[UBound($arLimitedcustomscripts3,1)-1][$filesvbs] = "" Then
                        $arLimitedcustomscripts3[UBound($arLimitedcustomscripts3,1)-1][$filesvbs] = $file
                    Else
                        ReDim $arLimitedcustomscripts3[UBound($arLimitedcustomscripts3,1)+1][$filesMAX]
                        $arLimitedcustomscripts3[UBound($arLimitedcustomscripts3,1)-1][$filesvbs] = $file
                    EndIf
                Case $sExt = ".cmd"
                    If $arLimitedcustomscripts3[UBound($arLimitedcustomscripts3,1)-1][$filescmd] = "" Then
                        $arLimitedcustomscripts3[UBound($arLimitedcustomscripts3,1)-1][$filescmd] = $file
                    Else
                        ReDim $arLimitedcustomscripts3[UBound($arLimitedcustomscripts3,1)+1][$filesMAX]
                        $arLimitedcustomscripts3[UBound($arLimitedcustomscripts3,1)-1][$filescmd] = $file
                    EndIf
            EndSelect
        ElseIf $account = "limited4" Then
            Select
                Case $sExt = ".reg"
                    If $arLimitedcustomscripts4[UBound($arLimitedcustomscripts4,1)-1][$filesreg] = "" Then
                        $arLimitedcustomscripts4[UBound($arLimitedcustomscripts4,1)-1][$filesreg] = $file
                    Else
                        ReDim $arLimitedcustomscripts4[UBound($arLimitedcustomscripts4,1)+1][$filesMAX]
                        $arLimitedcustomscripts4[UBound($arLimitedcustomscripts4,1)-1][$filesreg] = $file
                    EndIf
                Case $sExt = ".vbs"
                    If $arLimitedcustomscripts4[UBound($arLimitedcustomscripts4,1)-1][$filesvbs] = "" Then
                        $arLimitedcustomscripts4[UBound($arLimitedcustomscripts4,1)-1][$filesvbs] = $file
                    Else
                        ReDim $arLimitedcustomscripts4[UBound($arLimitedcustomscripts4,1)+1][$filesMAX]
                        $arLimitedcustomscripts4[UBound($arLimitedcustomscripts4,1)-1][$filesvbs] = $file
                    EndIf
                Case $sExt = ".cmd"
                    If $arLimitedcustomscripts4[UBound($arLimitedcustomscripts4,1)-1][$filescmd] = "" Then
                        $arLimitedcustomscripts4[UBound($arLimitedcustomscripts4,1)-1][$filescmd] = $file
                    Else
                        ReDim $arLimitedcustomscripts4[UBound($arLimitedcustomscripts4,1)+1][$filesMAX]
                        $arLimitedcustomscripts4[UBound($arLimitedcustomscripts4,1)-1][$filescmd] = $file
                    EndIf
            EndSelect
        ElseIf $account = "limited5" Then
            Select
                Case $sExt = ".reg"
                    If $arLimitedcustomscripts5[UBound($arLimitedcustomscripts5,1)-1][$filesreg] = "" Then
                        $arLimitedcustomscripts5[UBound($arLimitedcustomscripts5,1)-1][$filesreg] = $file
                    Else
                        ReDim $arLimitedcustomscripts5[UBound($arLimitedcustomscripts5,1)+1][$filesMAX]
                        $arLimitedcustomscripts5[UBound($arLimitedcustomscripts5,1)-1][$filesreg] = $file
                    EndIf
                Case $sExt = ".vbs"
                    If $arLimitedcustomscripts5[UBound($arLimitedcustomscripts5,1)-1][$filesvbs] = "" Then
                        $arLimitedcustomscripts5[UBound($arLimitedcustomscripts5,1)-1][$filesvbs] = $file
                    Else
                        ReDim $arLimitedcustomscripts5[UBound($arLimitedcustomscripts5,1)+1][$filesMAX]
                        $arLimitedcustomscripts5[UBound($arLimitedcustomscripts5,1)-1][$filesvbs] = $file
                    EndIf
                Case $sExt = ".cmd"
                    If $arLimitedcustomscripts5[UBound($arLimitedcustomscripts5,1)-1][$filescmd] = "" Then
                        $arLimitedcustomscripts5[UBound($arLimitedcustomscripts5,1)-1][$filescmd] = $file
                    Else
                        ReDim $arLimitedcustomscripts5[UBound($arLimitedcustomscripts5,1)+1][$filesMAX]
                        $arLimitedcustomscripts5[UBound($arLimitedcustomscripts5,1)-1][$filescmd] = $file
                    EndIf
            EndSelect    
                
        EndIf
    EndIf
EndFunc
Edited by NDog

Share this post


Link to post
Share on other sites

Yes you can have an array within an array. I think your best bet is to search 'Arrays' in the wiki and read up about them first.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

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