mdwerne Posted February 19, 2013 Posted February 19, 2013 So I am sequencially calling an array of MSI ID's to uninstall all versions of a program. As you can see from the array below, adding a new MSI ID to the array is starting to get long and tedious... How might I re-write the array below using a regex or two so that I can specify the range of numbers between the start and end points? In other words, a regex that covers all the MSI numbers below...no more, no less. If there is a forum page you can point me too that does something similar, I'd be more than happy to take a stab at it myself. $MSIArray = StringSplit("{26A24AE4-039D-4CA4-87B4-2F86416019FB},{26A24AE4-039D-4CA4-87B4-2F86416020FB}," & _ "{26A24AE4-039D-4CA4-87B4-2F86416021FB},{26A24AE4-039D-4CA4-87B4-2F86416022FB},{26A24AE4-039D-4CA4-87B4-2F86416023FB}," & _ "{26A24AE4-039D-4CA4-87B4-2F86416024FB},{26A24AE4-039D-4CA4-87B4-2F86416025FB},{26A24AE4-039D-4CA4-87B4-2F86416026FB}," & _ "{26A24AE4-039D-4CA4-87B4-2F86416027FB},{26A24AE4-039D-4CA4-87B4-2F86416028FB},{26A24AE4-039D-4CA4-87B4-2F86416029FB}," & _ "{26A24AE4-039D-4CA4-87B4-2F86416030FB},{26A24AE4-039D-4CA4-87B4-2F86416031FB},{26A24AE4-039D-4CA4-87B4-2F86416032FB}," & _ "{26A24AE4-039D-4CA4-87B4-2F86416033FB},{26A24AE4-039D-4CA4-87B4-2F86416034FB},{26A24AE4-039D-4CA4-87B4-2F86416035FB}," & _ "{26A24AE4-039D-4CA4-87B4-2F86416036FB},{26A24AE4-039D-4CA4-87B4-2F86416037FB},{26A24AE4-039D-4CA4-87B4-2F86416038FB}," & _ "{26A24AE4-039D-4CA4-87B4-2F86416039FB},{26A24AE4-039D-4CA4-87B4-2F86416040FB},{26A24AE4-039D-4CA4-87B4-2F86416041FB}," & _ "{26A24AE4-039D-4CA4-87B4-2F86417000FB},{26A24AE4-039D-4CA4-87B4-2F86417001FB},{26A24AE4-039D-4CA4-87B4-2F86417002FB}," & _ "{26A24AE4-039D-4CA4-87B4-2F86417003FB},{26A24AE4-039D-4CA4-87B4-2F86417004FB},{26A24AE4-039D-4CA4-87B4-2F86417005FB}," & _ "{26A24AE4-039D-4CA4-87B4-2F86417006FB},{26A24AE4-039D-4CA4-87B4-2F86417007FB},{26A24AE4-039D-4CA4-87B4-2F86417008FB}", ",") Thanks for any suggestions, -Mike
Moderators Melba23 Posted February 19, 2013 Moderators Posted February 19, 2013 mdwerne, Something like this should help: #include <Array.au3> $iStart = 6019 $iEnd = 7008 $iRange = $iEnd - $iStart + 1 Global $aArray[$iRange] For $i = 0 To $iRange - 1 $aArray[$i] = "{26A24AE4-039D-4CA4-87B4-2F8641" & ($iStart + $i) & "FB}" Next _ArrayDisplay($aArray) All clear? 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
mdwerne Posted February 19, 2013 Author Posted February 19, 2013 mdwerne, Something like this should help: #include <Array.au3> $iStart = 6019 $iEnd = 7008 $iRange = $iEnd - $iStart + 1 Global $aArray[$iRange] For $i = 0 To $iRange - 1 $aArray[$i] = "{26A24AE4-039D-4CA4-87B4-2F8641" & ($iStart + $i) & "FB}" Next _ArrayDisplay($aArray) All clear? M23 Perfectly clear, thank you!!
Moderators Melba23 Posted February 19, 2013 Moderators Posted February 19, 2013 mdwerne, My pleasure as always. 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
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