-
Posts
81 -
Joined
-
Last visited
Content Type
Forums
Downloads
Forum Articles
Events
Everything posted by DannyJ
-
I declared a const array, that I won't change and I can not change in the entire program. (Safety) Exept one point, one point I need to change this variable. My question is that can I delete the const variable and redeclare it? Or I need to remove Const to change the variable. If I remove const how can I make my variable "safe", because this variable can not be changed only the declaration and one point in the whole program. Thanks in advance!
-
How to make a GUICtrlCreateTreeView from a specific data?
DannyJ replied to DannyJ's topic in AutoIt General Help and Support
Thank you very much your help @Luke94 and @Nine -
Hello, I have a specific data, and I am thinking how to make from this data a TreeView. I would be grateful if you could me provide some hints or an algorithm. The data looks like this: Org/Unit1/Users Org/Unit1/Computers Org/Unit1/Computers/Wifi1 Org/Unit1/Computers/Wifi2 Org/Unit1/Computers/Guest/Wifi1 Org/Unit2/Company/Users Org/Unit2/Company/Tables Org/Unit2/Computers Do you have any idea or hint how to make a TreeView from this data? #include-once #include <GUIConstantsEx.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> Local $hGUI = GUICreate("ControlTreeView Example", 212, 212) Local $idTreeView_1 = GUICtrlCreateTreeView(6, 6, 200, 160, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_CHECKBOXES), $WS_EX_CLIENTEDGE) Local $hTreeView_1 = ControlGetHandle($hGUI, "", $idTreeView_1) Local $arr[] = [ "Org/Unit1/Users", _ "Org/Unit1/Computers", _ "Org/Unit1/Computers/Wifi1", _ "Org/Unit1/Computers/Wifi2", _ "Org/Unit1/Computers/Guest/Wifi1", _ "Org/Unit2/Company/Users", _ "Org/Unit2/Company/Tables", _ "Org/Unit2/Computers"] Local $idRoot = GUICtrlCreateTreeViewItem("Root", $idTreeView_1) GUICtrlCreateTreeViewItem("x", $idRoot) GUICtrlCreateTreeViewItem("Item 2", $idRoot) GUICtrlCreateTreeViewItem("Item 3", $idRoot) Local $idItem_4 = GUICtrlCreateTreeViewItem("Item 4", $idRoot) GUICtrlCreateTreeViewItem("Item 4.1 | Item 4.1.1 ", $idItem_4) GUICtrlCreateTreeViewItem("Item 4.2", $idItem_4) GUICtrlCreateTreeViewItem("Item 5", $idRoot) GUISetState(@SW_SHOW, $hGUI) ControlTreeView($hGUI, "", $hTreeView_1, "Expand", "Root") ;ControlTreeView($hGUI, "", $hTreeView_1, "Exists", "Root|Item 4") ;ControlTreeView($hGUI, "", $hTreeView_1, "Check", "Root|Item 4") ;ControlTreeView($hGUI, "", $hTreeView_1, "Select", "Root|Item 4") ;ControlTreeView($hGUI, "", $hTreeView_1, "Expand", "Root|Item 4") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI)
-
I tried to use $BS_AUTORADIOBUTTON from TreeViewStyles. Unfortunately it did not worked for me :(. Could you help to make ControlTreeView with radio buttons? Here is the default example of TreeView with CheckBoxes: #include <GUIConstantsEx.au3> #include <TreeViewConstants.au3> #include <WindowsConstants.au3> Example() Func Example() Local $hGUI = GUICreate("ControlTreeView Example", 212, 212) Local $idTreeView_1 = GUICtrlCreateTreeView(6, 6, 200, 160, BitOR($TVS_HASBUTTONS, $TVS_HASLINES, $TVS_LINESATROOT, $TVS_CHECKBOXES), $WS_EX_CLIENTEDGE) Local $hTreeView_1 = ControlGetHandle($hGUI, "", $idTreeView_1) Local $idRoot = GUICtrlCreateTreeViewItem("Root", $idTreeView_1) GUICtrlCreateTreeViewItem("Item 1", $idRoot) GUICtrlCreateTreeViewItem("Item 2", $idRoot) GUICtrlCreateTreeViewItem("Item 3", $idRoot) Local $idItem_4 = GUICtrlCreateTreeViewItem("Item 4", $idRoot) GUICtrlCreateTreeViewItem("Item 4.1", $idItem_4) GUICtrlCreateTreeViewItem("Item 4.2", $idItem_4) GUICtrlCreateTreeViewItem("Item 5", $idRoot) GUISetState(@SW_SHOW, $hGUI) ControlTreeView($hGUI, "", $hTreeView_1, "Expand", "Root") ControlTreeView($hGUI, "", $hTreeView_1, "Exists", "Root|Item 4") ControlTreeView($hGUI, "", $hTreeView_1, "Check", "Root|Item 4") ControlTreeView($hGUI, "", $hTreeView_1, "Select", "Root|Item 4") ControlTreeView($hGUI, "", $hTreeView_1, "Expand", "Root|Item 4") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd GUIDelete($hGUI) EndFunc ;==>Example
-
I am writing a program that checks, that a string is okay for a password. I need to chechk that the string contains at least a number a capital letter and a special charachter? Here is my example code: $Input = InputBox(64,"Type password","") If GUICtrlRead($Input) == "" Or $Input .... CHECK Then MsgBox(0,"password","password not okay") Else MsgBox(0,"okay","password okay") EndIf
-
How to properly create a Back Next Finish form?
DannyJ replied to DannyJ's topic in AutoIt GUI Help and Support
@Luke94 Thank you for your help -
How to properly create a Back Next Finish form?
DannyJ posted a topic in AutoIt GUI Help and Support
I have multiple forms, with next and back buttons. (Code below) My first question would be to this form, how to disable the back button with GUICtrlSetState($Button_2,$GUI_DISABLE), in the first form? My second question would, be If I am in the last page I need to change the button text to GUICtrlSetData($Button_1,"FINISH")? In essence, how to determine which page I am currently standing in my code below? The last and final question would be that, the program allows the user to click to the Next button if all the inputs are not empty or something written in the input, how to solve this? Thank you in advance your help #include <GuiConstants.au3> Dim $show = 0, $Child_[4], $children = 3, $Radio[11] $Main = GUICreate("MyGUI", (@DesktopWidth) / 4, (@DesktopHeight ) / 2, (@DesktopWidth) / 2, (@DesktopHeight ) / 2) $ButtonPostion_Y = 490 $Button_Width = 80 $Button_Height = 25 $CancelButtonPostion_X = 335 $NextButtonPostion_X = $CancelButtonPostion_X - $Button_Width - 10 $BackButtonPostion_X = $CancelButtonPostion_X- $Button_Width - $Button_Width - 10 $Button_1 = GUICtrlCreateButton("&Next >", $NextButtonPostion_X, $ButtonPostion_Y, $Button_Width, $Button_Height) $Button_2 = GUICtrlCreateButton("< &Back",$BackButtonPostion_X,$ButtonPostion_Y ,$Button_Width, $Button_Height) $Button_3 = GUICtrlCreateButton("&Cancel", $CancelButtonPostion_X, $ButtonPostion_Y, $Button_Width, $Button_Height) GUISetState() $Child_[1] = GUICreate("", 508, 238, 1, 1, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) $Label_1 = GuiCtrlCreateLabel("Child 1.", 40, 140, 290, 30) ;~ GUICtrlSetState($Button_2,$GUI_DISABLE) Not working properly GUICtrlSetFont(-1, 10, 650) $radio[1] = GUICtrlCreateInput ("", 10, 10, 120, 20) $radio[2] = GUICtrlCreateInput ("", 10, 40, 120, 20) GUISetState() $Child_[2] = GUICreate("", 508, 238, 1, 1, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) $Label_1 = GuiCtrlCreateLabel("Child 2.", 40, 140, 290, 30) GUICtrlSetState($Button_2,$GUI_ENABLE) GUICtrlSetFont(-1, 10, 650) $radio[3] = GUICtrlCreateInput ("", 10, 10, 120, 20) $radio[4] = GUICtrlCreateInput ("", 10, 40, 120, 20) GUISetState(@SW_HIDE) $Child_[3] = GUICreate("", 508, 238, 1, 1, BitOR($WS_CHILD, $WS_TABSTOP) + $WS_DLGFRAME, -1, $Main) ;~ GUICtrlSetData($Button_1,"FINISH") Not working properly $Label_1 = GuiCtrlCreateLabel("Child 3.", 40, 140, 290, 30) GUICtrlSetFont(-1, 10, 650) GUISetState(@SW_HIDE) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Or $msg = $Button_3 ExitLoop Case $msg = $Button_1 Set_Next() Case $msg = $Button_2 Set_Back() ;Case $msg = $Button_4 ; Set_Done() ;;; EndSelect WEnd ;--------- Functions ------------------- Func Set_Done() for $x = 1 to UBound($radio) -1 If _IsChecked($radio[$x]) Then MsgBox(0x0,"#" & $x, "You selected Radio " & $x, 2) Next EndFunc Func Set_Next() For $x = 1 To $children - 1 $Nwin = WinGetState($Child_[$x]) If $Nwin > 5 Then GUISetState(@SW_HIDE, $Child_[$x]) GUISetState(@SW_SHOW, $Child_[$x + 1]) Return EndIf Next EndFunc ;==>Set_Next Func Set_Back() For $x = $children To 1 Step - 1 $Nwin = WinGetState($Child_[$x]) If $Nwin > 5 Then GUISetState(@SW_HIDE, $Child_[$x]) GUISetState(@SW_SHOW, $Child_[$x - 1]) Return EndIf Next EndFunc ;==>Set_Back Func _IsChecked($control) Return BitAND(GUICtrlRead($control), $GUI_CHECKED) = $GUI_CHECKED EndFunc ;==>_IsChecked -
[Solved] Check wich ListView in use or selected?
DannyJ replied to DannyJ's topic in AutoIt General Help and Support
@Danyfirex thank you very much your help Have a nice day man! -
I have two ListViews (with itmes), and two buttons. I need an idea to, if I select an item from $List1 enable $Button1 and disable $Button2. The other $List2 works the same vay: if I select something from $List2 then I need to disable $Button1 and enable $Button2 Here is myexample code, which is not working #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <WindowsConstants.au3> #include <MsgBoxConstants.au3> #include <GuiListView.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 590, 399, 589, 289) $Button1 = GUICtrlCreateButton("Button1", 64, 272, 187, 25) $Button2 = GUICtrlCreateButton("Button2", 320, 272, 195, 25) $List1 = GUICtrlCreateListView("First ", 64, 56, 185, 175) $List2 = GUICtrlCreateListView("Second", 312, 64, 185, 175) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Local $idItem1 = GUICtrlCreateListViewItem("item1", $List1) Local $idItem2 = GUICtrlCreateListViewItem("item2", $List1) Local $idItem3 = GUICtrlCreateListViewItem("item3", $List1) Local $idItem4 = GUICtrlCreateListViewItem("item4", $List1) Local $idItem5 = GUICtrlCreateListViewItem("item5", $List1) Local $idItem21 = GUICtrlCreateListViewItem("item1", $List2) Local $idItem22 = GUICtrlCreateListViewItem("item2", $List2) Local $idItem23 = GUICtrlCreateListViewItem("item3", $List2) Local $idItem24 = GUICtrlCreateListViewItem("item4", $List2) Local $idItem25 = GUICtrlCreateListViewItem("item5", $List2) Local $iIndex = _GUICtrlListView_GetSelectedIndices($List1) Local $iIndex2= _GUICtrlListView_GetSelectedIndices($List2) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $iIndex ;MsgBox(0,"I","Button 1 ENable, Button2 Disable") GUISetState($Button1,$GUI_ENABLE) GUISetState($Button2,$GUI_DISABLE) Case $iIndex2 ;MsgBox(0,"I","Button 2 ENable, Button1 Disable") GUISetState($Button2,$GUI_ENABLE) GUISetState($Button1,$GUI_DISABLE) EndSwitch WEnd
-
AD (Active Directory Users and Computers) is a powerful tool, if you go to User Properties -> Attribute Editor -> proxyAddress. So I want to copy just the work of this little program. Here is my example script of my copy, how do I add the extra change values features? #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <GUIListBox.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> $Form1 = GUICreate("Multi-valued String Editor", 498, 437, 579, 334) $List1 = GUICtrlCreateList("", 40, 168, 289, 162) $Button1 = GUICtrlCreateButton("Add", 352, 120, 123, 25) $Button2 = GUICtrlCreateButton("Remove", 344, 168, 131, 25) $Input1 = GUICtrlCreateInput("", 40, 120, 281, 21) $Label1 = GUICtrlCreateLabel("Attribute", 40, 48, 44, 17) $Label2 = GUICtrlCreateLabel("proxyAddress", 128, 48, 92, 17) GUISetState(@SW_SHOW) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd
-
Here is an example script: I have inputs with default values (e.g names) What is the cleanest code and most simple way, that can collect the input values changed from default? What do you think are there any more solution, that is better? #include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <Array.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Form1", 615, 437, 593, 222) $Value1 = "Sample Name 1" $Value2 = "Sample Name 2 " $Value3 = "Sample Name 3" $Value4 = "Sample Name 4" $Value5 = "Sample Name 5" $Value6 = "Sample Name 6" $Input1 = GUICtrlCreateInput($Value1, 200, 40, 121, 21) $Input2 = GUICtrlCreateInput($Value2, 200, 72, 121, 21) $Input3 = GUICtrlCreateInput($Value3, 200, 104, 121, 21) $Input4 = GUICtrlCreateInput($Value4, 200, 136, 121, 21) $Input5 = GUICtrlCreateInput($Value5, 200, 168, 121, 21) $Input6 = GUICtrlCreateInput($Value6, 200, 216, 121, 21) $Button = GUICtrlCreateButton("Save",200,250,50,50) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button ButtonSave() EndSwitch WEnd Func ButtonSave() Local $WichInputs[110] $SomethingChanged = False If GUICtrlRead($Input1) <> $Value1 Then $SomethingChanged = True _ArrayAdd($WichInputs,$Input1) ElseIf GUICtrlRead($Input2) <> $Value2 Then $SomethingChanged = True _ArrayAdd($WichInputs,$Input2) ElseIf GUICtrlRead($Input3) <> $Value3 Then $SomethingChanged = True _ArrayAdd($WichInputs,$Input3) ElseIf GUICtrlRead($Input4) <> $Value4 Then $SomethingChanged = True _ArrayAdd($WichInputs,$Input4) ElseIf GUICtrlRead($Input4) <> $Value4 Then $SomethingChanged = True _ArrayAdd($WichInputs,$Input4) ElseIf GUICtrlRead($Input5) <> $Value5 Then $SomethingChanged = True _ArrayAdd($WichInputs,$Input5) ElseIf GUICtrlRead($Input6) <> $Value6 Then $SomethingChanged = True _ArrayAdd($WichInputs,$Input6) EndIf ;-DISPLAY CHANGED VALUES If $SomethingChanged == True Then MsgBox(0,"Changed","chenges FROM TO" & _ArrayToString($WichInputs,@TAB) ) Else MsgBox(0,"No","No chenges") EndIf EndFunc
-
Example code with GUI and an exaple search You can download GUIListViewEx.au that is necessary to run the script #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" #include <Array.au3> Global $iCount_Left = 20, $vData, $sMsg, $aLV_List_Left, $aLV_List_Right, $aRet, $iEditMode = 0 ; Create GUI $hGUI = GUICreate("LVEx Example 1", 640, 510) $PeopleNUM = 10 $DataNum = 4 Local $People[$PeopleNUM][$DataNum] = [["Peter", "[email protected]", "+10", "Boss"] _ , ["Tom", "[email protected]", "+10", "Boss"] _ , ["Adam", "[email protected]", "+10", "Manager"] _ , ["Mark", "[email protected]", "+10", "Manager"] _ , ["John", "[email protected]", "+10", "Manager"] _ , ["Dava", "[email protected]", "+10", "Developer"] _ , ["Marta", "[email protected]", "+10", "Tester"] _ , ["Emilia", "[email protected]", "+10", "Tester"] _ , ["Sample1", "[email protected]", "+10", "Tester"] _ , ["Sample2", "Sample2@@mycompany.com", "+10", "New"]] ; Create Right ListView GUICtrlCreateLabel("UDF ListView", 10, 5, 300, 30) $hListView_Right = _GUICtrlListView_Create($hGUI, "", 10, 40, 500, 300, BitOR($LVS_DEFAULT, $WS_BORDER)) _GUICtrlListView_SetExtendedListViewStyle($hListView_Right, $LVS_EX_FULLROWSELECT) _GUICtrlListView_AddColumn($hListView_Right, "Name", 83) _GUICtrlListView_AddColumn($hListView_Right, "E-mail", 83) _GUICtrlListView_AddColumn($hListView_Right, "Phone", 83) _GUICtrlListView_AddColumn($hListView_Right, "title", 83) _GUICtrlListView_SetTextBkColor($hListView_Right, 0xDDFFDD) ; Fill Right ListView For $i = 0 To $PeopleNUM - 1 _GUICtrlListView_AddItem($hListView_Right, $People[$i][0]) For $j = 0 To $DataNum - 1 _GUICtrlListView_AddSubItem($hListView_Right, $i, $People[$i][$j], $j) Next Next ; Read array from Right ListView Global $aLV_List_Right = _GUIListViewEx_ReadToArray($hListView_Right, 1) ; Initiate LVEx - use read content as array - count parameter set - red insert mark - drag image - move edit by click + headers editable $iLV_Right_Index = _GUIListViewEx_Init($hListView_Right, $aLV_List_Right, 1, 0xFF0000, True, 4 + 8) ; All columns editable - simple text selected on open _GUIListViewEx_SetEditStatus($iLV_Right_Index, "*") ; Create buttons $cInsert_Button = GUICtrlCreateButton("Insert", 10, 350, 200, 30) $cDelete_Button = GUICtrlCreateButton("Delete", 10, 390, 200, 30) $cUp_Button = GUICtrlCreateButton("Move Up", 220, 350, 200, 30) $cDown_Button = GUICtrlCreateButton("Move Down", 220, 390, 200, 30) ;$cEdit_Left_Button = GUICtrlCreateButton("Edit Left 1,1", 10, 430, 200, 30) $SearchInput = GUICtrlCreateInput("Search", 10, 430, 200, 30) $SearchButton = GUICtrlCreateButton("Search", 220, 430, 200, 30) $cDisplay_Right_Button = GUICtrlCreateButton("Show Right", 530, 350, 100, 30) $cExit_Button = GUICtrlCreateButton("Exit", 430, 390, 200, 110) ; Register for sorting, dragging and editing _GUIListViewEx_MsgRegister() GUISetState() ; Set the left ListView as active ; _GUIListViewEx_SetActive(1) Switch _GUIListViewEx_GetActive() Case 0 $sMsg = "No ListView is active" Case 1 $sMsg = "The LEFT ListView is active" & @CRLF & "<--------------------------" Case 2 $sMsg = "The RIGHT ListView is active" & @CRLF & "---------------------------->" EndSwitch ;MsgBox(0, "Active ListView", $sMsg) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $cExit_Button Exit Case $cDelete_Button _GUIListViewEx_Delete() Case $cUp_Button _GUIListViewEx_Up() Case $cDown_Button _GUIListViewEx_Down() Case $cDisplay_Right_Button $aLV_List_Right = _GUIListViewEx_ReturnArray($iLV_Right_Index) If Not @error Then _ArrayDisplay($aLV_List_Right, "Returned Right") Else MsgBox(0, "Right", "Empty Array") EndIf Case $SearchButton $inputValue = GUICtrlRead($SearchInput) SearchInArray($People,$inputValue) EndSwitch $vRet = _GUIListViewEx_EventMonitor($iEditMode) ; Use combos to change EditMode If @error Then MsgBox($MB_SYSTEMMODAL, "Error", "Event error: " & @error) EndIf Switch @extended Case 0 ; No event detected Case 1 If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Edit", "Edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " content edited", Default, 8) EndIf Case 2 If $vRet = "" Then MsgBox($MB_SYSTEMMODAL, "Header edit", "Header edit aborted" & @CRLF) Else _ArrayDisplay($vRet, "ListView " & _GUIListViewEx_GetActive() & " header edited", Default, 8) EndIf Case 3 MsgBox($MB_SYSTEMMODAL, "Sorted", "ListView: " & $vRet & @CRLF) Case 4 MsgBox($MB_SYSTEMMODAL, "Dragged", "From:To" & @CRLF & $vRet & @CRLF) EndSwitch WEnd Func SearchInArray($array, $valueToSearch) $Found = _ArraySearch($array, $valueToSearch, 0, 0, 0, 1) MsgBox($MB_ICONINFORMATION, "Found", "I have found in " & $Found & " row!") _GUICtrlListView_SetItemFocused($hListView_Right, $Found - 1) ;_GUICtrlListViewSetItemSelState($hListView_Right,$Found-1) EndFunc ;==>SearchInArray I would add a feature to my sript if I search for a worker for exaple boss, the view list the Bosses only. Or If I try to list the e-mails with @mycompany.com. You can try listing feature if you type get-ChildItem | Out-GridView to PowerShell, and there is a filter field. I try to implement something like this filter field. Thank you very much your assistance any idea would be appriciated.
-
I managed to solve this problem: ............ Local $aArray = StringRegExp($sOutput, "(?|filterd commands)\h*:\h*(.*)", 3) _ArrayDisplay($aArray) $CommandLength = 14 ; convert 1d array into 2d array Local $aFinal[UBound($aArray) / $CommandLength][$CommandLength] For $i = 0 To UBound($aFinal) - 1 $aFinal[$i][0] = _WinAPI_OemToChar($aArray[$i * $CommandLength]) $aFinal[$i][1] = _WinAPI_OemToChar($aArray[$i * $CommandLength + 1]) $aFinal[$i][2] = _WinAPI_OemToChar($aArray[$i * $CommandLength + 2]) $aFinal[$i][3] = _WinAPI_OemToChar($aArray[$i * $CommandLength + 3]) $aFinal[$i][4] = _WinAPI_OemToChar($aArray[$i * $CommandLength + 4]) $aFinal[$i][5] = _WinAPI_OemToChar($aArray[$i * $CommandLength + 5]) .............. When I fill the final array I use _WinAPI_OemToChar function, so it changes line by line. Thank you very much your help: @Nine and @argumentum and @Jos I mark this topic closed.
-
@Jos Thank you very much your help. @Nine and @argumentum than you for your help, your solution with _WinAPI_OemToChar works perfectly. Do you have any idea why I get this error: AutoIt3.exe ended.rc:-1073741819? If I use powershell.exe Get-ChildItem | Format-List Here is a my code: ; Script Start - Add your code below here #include <AutoItConstants.au3> #include <WinAPIConv.au3> #include <ButtonConstants.au3> #include <ComboConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <File.au3> #include <GuiEdit.au3> #include <Array.au3> #include <String.au3> #include <StringConstants.au3> #RequireAdmin #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #EndRegion Test() Func Test() ;Local $sCommand = "powershell.exe Get-ChildItem" Local $sCommand = "powershell.exe Get-ChildItem | Format-List " Local $iPid = Run($sCommand, @DesktopDir, @SW_SHOW, $STDOUT_CHILD) ProcessWaitClose($iPid) Local $sOutput = StdoutRead($iPid) ; ConsoleWrite(_WinAPI_OemToChar($sOutput)) ; @nine's solution ConsoleWrite($sOutput) _WinAPI_OemToChar($sOutput) ; I get this error if I use | Format-List pipe EndFunc I would be very grateful If you could check my code and run with Get-ChildItem | Format-List, I have no idea why I get the above mentioned error. Ps.: Unfortunately I need Format-List to make array from the command, and I use another commands as well.
-
Thank you very much @Nine Here is my new code snippet: #include-once #Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_UseX64=y #AutoIt3Wrapper_Res_Language=1038 #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <Array.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #include "GUIListViewEx.au3" #include <WinAPIConv.au3> #Include <WinAPI.au3> #include <WinAPIConv.au3> ;--------END OF INCLUDES--------------------------------- Local Const $SF_ANSI = 1 Local Const $SF_UTF16_LE = 2 Local Const $SF_UTF16_BE = 3 Local Const $SF_UTF8 = 4 $sCommand = "powershell.exe Get-ChildItem" Local $iPid = Run($sCommand, @DesktopDir, @SW_SHOW, $STDOUT_CHILD) ProcessWaitClose($iPid) Local $sOutput = StdoutRead($iPid) MsgBox(0,"a", (_WinAPI_WideCharToMultiByte($sOutput,2 ))) MsgBox(0,"a", (_WinAPI_WideCharToMultiByte($sOutput,65000 ))) MsgBox(0,"a", (_WinAPI_WideCharToMultiByte($sOutput,65001 ))) Unfortunately none of them works Do you have any other idea?