kaotkbliss Posted November 6, 2009 Share Posted November 6, 2009 I have this code: $Log = _FileListToArray("L:\Client\LLS_\Daily\Print\", @YEAR&"*", 2) $yyyymmdd1 = 0 $yyyymmdd2 = IniRead("C:\variables.ini","llstime",1,"0") For $i = 1 to $Log[0] $aTime = FileGetTime("L:\Client\LLS_\Daily\Print\"&$Log[$i], 1) $yyyymmdd1 = $aTime[0] & $aTime[1] & $aTime[2] & $aTime[3] & $aTime[4] If $yyyymmdd1 > $yyyymmdd2 Then $yyyymmdd2 = $yyyymmdd1 $LLSRecent = $Log[$i] $spot=1 $Log2 = _FileListToArray("L:\Client\LLS_\Daily\Print\"&$LLSRecent&"\","*One*", 2) $yyyymmdd3 = 0 $yyyymmdd4 = IniRead("C:\variables.ini","llstime",2,"0") For $i2 = 1 to $Log2[0] $aTime2 = FileGetTime("L:\Client\LLS_\Daily\Print\"&$LLSRecent&"\"&$Log2[$i2], 1) $yyyymmdd3 = $aTime2[0] & $aTime2[1] & $aTime2[2] & $aTime2[3] & $aTime2[4] If $yyyymmdd3 > $yyyymmdd4 Then $yyyymmdd4 = $yyyymmdd3 $LLSRecent2 = $Log2[$i2] $check=IniRead("C:\path.ini","llspath",$spot,"") If $check="" Then IniWrite("C:\path.ini","llspath",$spot,"L:\Client\LLS_\Daily\Print\"&$LLSRecent&"\"&$LLSRecent2) EndIf $spot=$spot+1 Next IniWrite("C:\variables.ini","llstime",2,$yyyymmdd4) EndIf IniWrite("C:\variables.ini","llstime",1,$yyyymmdd2) Next Return and what it does is gets a folder from a path, gets it's sub folders then writes the paths into an ini file moves to the next folder and grabs it's sub folders and so on. the problem is, if there is no sub folders then the script errors out and closes. how can I step out of the inner loop and back to the main loop if there are no sub folders? currently it gives me an error in $log2 - subscript used with non-array variable. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 6, 2009 Moderators Share Posted November 6, 2009 kaotkbliss,Include an "If Not IsArray($Log2)" line after the "$Log2 = _FileListToArray(..." line. Then if there are no subfolders you can continue on your way without entering the "For $i2 = 1 to $Log2[0]" loop.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...
kaotkbliss Posted November 6, 2009 Author Share Posted November 6, 2009 kaotkbliss, Include an "If Not IsArray($Log2)" line after the "$Log2 = _FileListToArray(..." line. Then if there are no subfolders you can continue on your way without entering the "For $i2 = 1 to $Log2[0]" loop. M23 thank you for the help. I added that in then got an error message If with no Then, so I tried to add If Then Next, but of course that didn't work. I figured if I did Then EndIf it would simply end it's own if and simply continue on as before, so what I ended up doing is adding If IsArray($Log2) Then right after _FileListToArray then added another EndIf after the loop. 010101000110100001101001011100110010000001101001011100110010000 001101101011110010010000001110011011010010110011100100001 My Android cat and mouse gamehttps://play.google.com/store/apps/details?id=com.KaosVisions.WhiskersNSqueek We're gonna need another Timmy! Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted November 6, 2009 Moderators Share Posted November 6, 2009 kaotkbliss, That sounds right - besides, if it works it must be! 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