nacerbaaziz Posted June 20, 2020 Posted June 20, 2020 hello autoit team please i need your help today am trying to make the list of features in list view and control it am using the dism command line to read output i've made the code but i found some problems what i need is the list of features in 2d array $array[$n][0]= name $array[$i][1] = state when i tested the code it give me some results that i don't need to it e.g ------ ------ | -------- or name | state i need just the list of features and there state please help me to do that here is my example #RequireAdmin #NoTrayIcon #include <AutoItConstants.au3> Wow64EnableWow64FsRedirection(false) _Windows_Get_Features() func _Windows_Get_Features() local $a_FeaturesArray[1][2] $a_FeaturesArray[0][0] local $i_Dism_Run = Run("DISM /online /english /get-features /format:table", "", @sw_hide, BitOR($STDERR_CHILD, $STDOUT_CHILD)) local $s_OutputDism = "", $a_OutPutDism While 1 $s_OutputDism = StdoutRead($i_Dism_Run) If @error Then exitLoop if ($s_OutputDism = "") or (StringRegExp($s_OutputDism, "^((\-){1,})?(?:\s)\|?(?:\s)((\-){1,})$", 0) = 1) then ContinueLoop if (StringRegExp($s_OutputDism, "((([\s\d\-\+\_\,]{1})\|([\s\d\-\+\_\,]{1})){1,})", 0) = 1) then $a_OutPutDism = StringSplit($s_OutputDism, @lf) for $i = 1 to $a_OutPutDism[0] if msgBox(1, $i, $a_OutPutDism[$i]) = 1 then exitLoop next endIf Wend endFunc func Wow64EnableWow64FsRedirection($b_Enabled) local $h_OpenFS = DLLOpen("kernel32.dll") local $Return = DllCall($h_OpenFS, "boolean", "Wow64EnableWow64FsRedirection", "boolean", $b_Enabled) if @error then DLLClose($h_OpenFS) Return SetError(@error, @extended, -1) else DLLClose($h_OpenFS) Return $Return[0] endIf endFunc
Nine Posted June 20, 2020 Posted June 20, 2020 This : #RequireAdmin #NoTrayIcon #include <AutoItConstants.au3> #include <StringConstants.au3> #include <Array.au3> #include <WinAPIFiles.au3> _WinAPI_Wow64EnableWow64FsRedirection(False) Local $aFeature = _Windows_Get_Features() _ArrayDisplay ($aFeature) Func _Windows_Get_Features() Local $i_Dism_Run = Run("DISM /online /english /get-features /format:table", "", @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD)) ProcessWaitClose ($i_Dism_Run) Local $s_OutputDism = StdoutRead($i_Dism_Run) Local $array = StringSplit ($s_OutputDism, @CRLF, $STR_ENTIRESPLIT), $tmp, $final [$array[0]][2], $count For $i = 1 to $array[0] $tmp = StringSplit ($array[$i], "|") If $tmp[0] <> 2 Or StringLeft($array[$i], 4) = "----" Or StringLeft($array[$i],12) = "Feature Name" Then ContinueLoop $final[$count][0] = $tmp [1] $final[$count][1] = $tmp [2] $count += 1 Next ReDim $final[$count][2] Return $final EndFunc ;==>_Windows_Get_Features nacerbaaziz 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
nacerbaaziz Posted June 20, 2020 Author Posted June 20, 2020 @Nine it's work perfectly thank you very very much accept my greetings
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