Toco1982 Posted December 21, 2012 Share Posted December 21, 2012 Hello Community,I use AutoIT quite a while now and somehow I seem to be mentally blocked I am facing the following problem:I have 2 script files:test1test2Test2 contains the function definition as follows:"Func PaketInstaller($InstSprache, $LogFileHandle, $Software, $Pfad, $WinVersion, $Architektur)"$InstSprache, $Pfad, $WinVersion, $Architektur= String$LogFileHandle = Handle to a txt file$Software = Array[8]Test1:From the script in test1 I want to call the function which is defined in test2.The big problem which I am confronted with is transmitting the array "$Software" successfully without getting an array fault with the following code:Local $avPakete[8] = [0,0,0,0,0,0,0,0]$avPakete[0] = GUICtrlRead($cbx_1)$avPakete[1] = GUICtrlRead($cbx_2)$avPakete[2] = GUICtrlRead($cbx_3)$avPakete[3] = GUICtrlRead($cbx_4)$avPakete[4] = GUICtrlRead($cbx_5)$avPakete[5] = GUICtrlRead($cbx_6)$avPakete[6] = GUICtrlRead($cbx_7)$avPakete[7] = GUICtrlRead($cbx_8)PaketInstaller($SelSprache, $file, $avPakete, $InstPfad, $win, $arc)When I call my function I always get the following error:"Error Subscript used with non-Array variable"Can somebody please help me how to use / define a function in AutoIT with an array as a parameter!?Somehow I am not that experienced with Basic but with other languages I would have solved it easily but here I am totally mentally blocked at the moment Many thanks in advance!GreetingsToco1982 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 21, 2012 Moderators Share Posted December 21, 2012 (edited) Toco1982, What you have seems to work fine for me: ; Simulate including test2: Func PaketInstaller($InstSprache, $LogFileHandle, $Software, $Pfad, $WinVersion, $Architektur) MsgBox(0, "Here", "In the function") EndFunc ; Here is test1 Local $avPakete[8] ; No need to define elements if you assign them later Local $SelSprache, $file, $InstPfad, $win, $arc ; Simulate filling the array $avPakete[0] = 1 ; GUICtrlRead($cbx_1) $avPakete[1] = 1 ; GUICtrlRead($cbx_2) $avPakete[2] = 1 ; GUICtrlRead($cbx_3) $avPakete[3] = 1 ; GUICtrlRead($cbx_4) $avPakete[4] = 1 ; GUICtrlRead($cbx_5) $avPakete[5] = 1 ; GUICtrlRead($cbx_6) $avPakete[6] = 1 ; GUICtrlRead($cbx_7) $avPakete[7] = 1 ; GUICtrlRead($cbx_8) PaketInstaller($SelSprache, $file, $avPakete, $InstPfad, $win, $arc) MsgBox(0, "Here", "Back from the function") Perhaps if you posted both complete scripts we might be able to spot where the problem lies. M23 P.S. Welcome to the the AutoIt forum, by the way. Edited December 21, 2012 by Melba23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Toco1982 Posted December 21, 2012 Author Share Posted December 21, 2012 Thanks Melba23!Sometimes I could kick myself In my code I found a stupid defintion:Local $Nordic = ["Schwedisch", "Dänisch", "Finnisch", "Norwegisch"]... so there is the problem ... so stupid >_< Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted December 21, 2012 Moderators Share Posted December 21, 2012 Toco1982, Happens to us all. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area 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