Apophus Posted November 24, 2020 Share Posted November 24, 2020 I'm scratching my head raw trying to figure out what I'm doing wrong in the short script below causing the "Variable cannot be accessed" error #Include <File.au3> #Include <Array.au3> $idir = "D:\LittleOne Music\My IPOD" ; Get list of sub-folders in $idir $FolderList=_FileListToArray($iDir) $edl = $FolderList[0] ; $edl = number of sub-folders in $idir ; Now get a list of the files in each sub-folder - set $mdir to the name of the $dix(nth) sub-folder For $dix = 1 To $edl $mdir = $FolderList($dix) $FileList=_FileListToArray($mdir) ==> Variable cannot be accessed in this manner.Next Link to comment Share on other sites More sharing options...
Danp2 Posted November 24, 2020 Share Posted November 24, 2020 8 minutes ago, Apophus said: $mdir = $FolderList($dix) Change the parentheses to square brackets and it should work. 😎 Latest Webdriver UDF Release Webdriver Wiki FAQs Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted November 24, 2020 Moderators Share Posted November 24, 2020 (edited) Welcome to the forum. In short, your issue is you have no error checking. I see the likely issue, but this is a good learning opportunity. Does $mdir return what you would expect it to? Edit: Or forget the whole "Teach a Man to Fish" motto 😄 Edited November 24, 2020 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Apophus Posted November 28, 2020 Author Share Posted November 28, 2020 On 11/24/2020 at 12:44 PM, Danp2 said: Change the parentheses to square brackets and it should work. 😎 Thank you. I was mistakenly sure that parentheses were the proper symbols to enclose a subscript. Hard to tell the difference on my laptop. I also didn't place the error message on the correct line; should have been on $mdir = $FolderList($dix) . 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