Chimaera Posted May 18, 2013 Share Posted May 18, 2013 (edited) Just browsing through the helpfile trying to solve a problem and i wasnt sure about this For eg I have a number of different files to check for in a folder but they have different executions depending on whats available, and there maybe more than one type available. So i need it to keep going until they are all done eg of one below $aRarFile = _RecFileListToArray(@ScriptDir, "*.7z", 1, 0) ;~ _ArrayDisplay($aRarFile, ".Rar Files") If IsArray($aRarFile) Then $test = RunWait(@ComSpec & ' /c ' & @TempDir & '\7z.exe' & ' x -y ' & '"' & $FileEnd & '"', "", @SW_HIDE) Sleep(200) EndIf So i was debating using Select Case $aRarFile = _RecFileListToArray(@ScriptDir, "*.7z", 1, 0) ;~ _ArrayDisplay($aRarFile, ".Rar Files") If IsArray($aRarFile) Then $test = RunWait(@ComSpec & ' /c ' & @TempDir & '\7z.exe' & ' x -y ' & '"' & $FileEnd & '"', "", @SW_HIDE) EndIf ContinueCase Case $aRarFile = _RecFileListToArray(@ScriptDir, "*.rar", 1, 0) ; etc etc Endselect But the bit im not sure about is Does ContinueCase override Select's natural only first one is executed setting? Edited May 18, 2013 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted May 18, 2013 Moderators Share Posted May 18, 2013 Chimaera, No, only the first True case will fire. All ContinueCase does is to run the code in the next Case down regardless of the condition: $iTest = 10 Switch $iTest Case 10 ConsoleWrite("$iTest = 10" & @CRLF) Case 11 ConsoleWrite("$iTest = 11" & @CRLF) Case 12 ConsoleWrite("$iTest = 12" & @CRLF) EndSwitch ConsoleWrite(@CRLF) $iTest = 20 Switch $iTest Case 20 ConsoleWrite("$iTest = 20" & @CRLF) ContinueCase Case 21 ConsoleWrite("$iTest = 21" & @CRLF) ContinueCase Case 22 ConsoleWrite("$iTest = 22" & @CRLF) EndSwitch Clearer now? 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...
Chimaera Posted May 18, 2013 Author Share Posted May 18, 2013 (edited) Ok so that will not achieve what im after. What about Do - Until can i make that do a number of times through? Cant say ive ever used it EDIT unfortunatly they dont have compatible search params so i cant lump them all together Edit 2 Solved now by making 4 different functions and run them from a master function Edited May 18, 2013 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
czardas Posted May 18, 2013 Share Posted May 18, 2013 What I would be inclined to do would be to count tasks upon completion. Put all the conditions in a loop (eg: Do ... Until $iCount = 10). caution is required that you don't count the same task twice. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
czardas Posted May 19, 2013 Share Posted May 19, 2013 My code example can be improved, but it is only intended as an example of a Select statement within a Do Until loop. Local $iTest1 = True, $iTest2 = True, $iTest3 = True, $iTest4 = True, $iTest5 = True, $iTest6 = True, $iCount = 0 Do Select Case $iTest1 And @SEC >= 0 And @SEC < 10 ConsoleWrite(@SEC & @LF) $iTest1 = False $iCount += 1 Case $iTest2 And @SEC >= 10 And @SEC < 20 ConsoleWrite(@SEC & @LF) $iTest2 = False $iCount += 1 Case $iTest3 And @SEC >= 20 And @SEC < 30 ConsoleWrite(@SEC & @LF) $iTest3 = False $iCount += 1 Case $iTest4 And @SEC >= 30 And @SEC < 40 ConsoleWrite(@SEC & @LF) $iTest4 = False $iCount += 1 Case $iTest5 And @SEC >= 40 And @SEC < 50 ConsoleWrite(@SEC & @LF) $iTest5 = False $iCount += 1 Case $iTest6 And @SEC >= 50 And @SEC < 60 ConsoleWrite(@SEC & @LF) $iTest6 = False $iCount += 1 EndSelect Until $iCount = 6 operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Chimaera Posted May 19, 2013 Author Share Posted May 19, 2013 (edited) So the icount forces it to run each section until the required condition is met I resolved my original problem by creating a master function (my terminology) Func _UnRar() ; Unpack all files Local $CleanUpData = _RecFileListToArray(@ScriptDir, "*|*acker.exe;*.au3", 1, 0) ;~ _ArrayDisplay($CleanUpData, "CleanUp Files") If IsArray($CleanUpData) Then _Archive_1() _Archive_2() _Archive_3() _Archive_4() Else MsgBox(64, "Error " & @error, " No Rar Files Available For Extraction", 2) EndIf $CleanUpFiles = $CleanUpData Return $CleanUpFiles EndFunc ;==>_UnRar Func _Archive_1() $aRarFile = _RecFileListToArray(@ScriptDir, "*.rar|*.part*", 1, 0) ;~ _ArrayDisplay($aRarFile, ".Rar Files") If IsArray($aRarFile) Then For $i = 1 To $aRarFile[0] $test = RunWait(@ComSpec & ' /c ' & @TempDir & '\7z.exe' & ' x -y ' & '"' & $aRarFile[$i] & '"', "", @SW_HIDE) Next EndIf Sleep(200) EndFunc ;>> _Archive_1() and then make each array work properly on its own and call them one after another. Thanks for the explanation though Edited May 19, 2013 by Chimaera If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
czardas Posted May 19, 2013 Share Posted May 19, 2013 Your method is possibly better, but it's a good idea to get used to the options available. operator64 ArrayWorkshop Link to comment Share on other sites More sharing options...
Chimaera Posted May 19, 2013 Author Share Posted May 19, 2013 I tend to be very one dimensional i guess with Autoit I get something that works and stick with it where possible, probably because i don't code for a living and my stuff rarely branches out, like my solution above it reuses what i know to get the job done. Im doing something different atm which requires me to revisit stuff so its all good really If Ive just helped you ... miracles do happen. Chimaera CopyRobo() * Hidden Admin Account Enabler * Software Location From Registry * Find Display Resolution * _ChangeServices() Link to comment Share on other sites More sharing options...
czardas Posted May 19, 2013 Share Posted May 19, 2013 (edited) I tend to be very one dimensional i guess with Autoit I'm the same although I hate to admit it. I can pretty much most things with strings arrays numbers and loops. There are lots of alternatives I could use, but the time to learn new things has to be weighed against other time constraints. I often wait until I have a working model before I think of ways to improve things. Then if I do adopt a different approach, I can see (and appreciate) the differences. Edited May 19, 2013 by czardas operator64 ArrayWorkshop 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