dadabre3232 Posted September 22, 2017 Share Posted September 22, 2017 so i have this weird error , im pretty sure it used to work before lets say i got an array $array[10][10] i have every array define $array[1][0] = "blabla" now the issue is this ; when i just use msgbox(0,"",$array[1][0]) its fine it returns the array but when i use it in function func blabla() msgbox(0,"",$array[1][0]) - i get blank message endfunc Can anyone help me please? Link to comment Share on other sites More sharing options...
dadabre3232 Posted September 22, 2017 Author Share Posted September 22, 2017 double post accident Link to comment Share on other sites More sharing options...
spudw2k Posted September 22, 2017 Share Posted September 22, 2017 I suspect it has to do with the scope in which the array is/was defined. Where in the script are you creating the array, because in your simple example above it is not defined which means it would have to be scoped globally for the function to know about it. Can you post more code? Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
dadabre3232 Posted September 22, 2017 Author Share Posted September 22, 2017 array is defined as global before using , maybe thats the issue ? i have global $array[10][10] at start Link to comment Share on other sites More sharing options...
dadabre3232 Posted September 22, 2017 Author Share Posted September 22, 2017 and to make stuff more intereseting same script , copy pasted into brand new autoit file ... works Link to comment Share on other sites More sharing options...
spudw2k Posted September 22, 2017 Share Posted September 22, 2017 32 minutes ago, dadabre3232 said: array is defined as global before using , maybe thats the issue ? nope. You need to make the array available/accessible within the function somehow, either by declaring it in the global scope or sending it to the function as a parameter. 14 minutes ago, dadabre3232 said: pasted into brand new autoit file ... works hmm, odd. Spoiler Things I've Made: Always On Top Tool ◊ AU History ◊ Deck of Cards ◊ HideIt ◊ ICU ◊ Icon Freezer ◊ Ipod Ejector ◊ Junos Configuration Explorer ◊ Link Downloader ◊ MD5 Folder Enumerator ◊ PassGen ◊ Ping Tool ◊ Quick NIC ◊ Read OCR ◊ RemoteIT ◊ SchTasksGui ◊ SpyCam ◊ System Scan Report Tool ◊ System UpTime ◊ Transparency Machine ◊ VMWare ESX BuilderMisc Code Snippets: ADODB Example ◊ CheckHover ◊ Detect SafeMode ◊ DynEnumArray ◊ GetNetStatData ◊ HashArray ◊ IsBetweenDates ◊ Local Admins ◊ Make Choice ◊ Recursive File List ◊ Remove Sizebox Style ◊ Retrieve PNPDeviceID ◊ Retreive SysListView32 Contents ◊ Set IE Homepage ◊ Tickle Expired Password ◊ Transpose ArrayProjects: Drive Space Usage GUI ◊ LEDkIT ◊ Plasma_kIt ◊ Scan Engine Builder ◊ SpeeDBurner ◊ SubnetCalcCool Stuff: AutoItObject UDF ◊ Extract Icon From Proc ◊ GuiCtrlFontRotate ◊ Hex Edit Funcs ◊ Run binary ◊ Service_UDF Link to comment Share on other sites More sharing options...
dadabre3232 Posted September 22, 2017 Author Share Posted September 22, 2017 it works in some funcs in some it doesnt weird , i have a function that compares inputs with the predefined ini file, works outside func, inside doesnt global $list[5][3] $list[1][1] = iniread... msgbox(0,"",$list[1][1]) - works here $list[1][2]=guiread.... func compare($i) msgbox(0,"",$list[1][1]) - empty here if $list[$i][1] = "" or $list[$i][2] = "" then Return if $list[$i][1] <> $list[$i][2] Then msgbox(0,"","different") EndIf EndFunc for $i = 1 to 5 compare($i) next scripts returns everytime cause somehow list is empty inside the func and fine outside... Link to comment Share on other sites More sharing options...
JohnOne Posted September 22, 2017 Share Posted September 22, 2017 Do you get access error? The problem with pseudo code is that no-one can test it. If you were to try to create a real script that people could test, I guarantee you will realize you error along the way. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
dadabre3232 Posted September 22, 2017 Author Share Posted September 22, 2017 the thing is , whatever value i add to the variable , it works only inside the function that did that , it like resets right after function passess Link to comment Share on other sites More sharing options...
KickStarter15 Posted September 22, 2017 Share Posted September 22, 2017 Try putting the For...Next within the function. Programming is "To make it so simple that there are obviously no deficiencies" or "To make it so complicated that there are no obvious deficiencies" by C.A.R. Hoare. Link to comment Share on other sites More sharing options...
JohnOne Posted September 22, 2017 Share Posted September 22, 2017 I understand what your thing is, but I can say with almost 100% certainty that you script is much more complicated with more stuff going on. Create a simple minimal script which reproduces your issue, along with a temp ini file. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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