Jump to content

List tags or array


Go to solution Solved by Subz,

Recommended Posts

Hello all.

It's me again..

So this is what I try to do : 

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GUIListView.au3>
#include <WindowsConstants.au3>
#Region
$Form1 = GUICreate("Form1", 332, 267, 192, 124)
$List1 = GUICtrlCreateListView("11111", 32, 24, 249, 175)
$LH = GUICtrlGetHandle($List1)
_GUICtrlListView_AddItem($List1, "Item1")
_GUICtrlListView_AddItem($List1, "Item2")

$Button1 = GUICtrlCreateButton("Button1", 120, 208, 75, 25)

GUISetState(@SW_SHOW)
#EndRegion

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $x = _GUICtrlListView_GetItemTextString($LH, _GUICtrlListView_GetSelectedIndices($LH))
            WinActivate("Command Prompt")
            WinWaitActive("Command Prompt")
            Send($x)

    EndSwitch
WEnd

 

The issue :   I want a list that you can select from. when an item is selected I want to send some info in CMD. So I need to be able and assign some criterias on this : 

_GUICtrlListView_AddItem($List1, "Item1")
_GUICtrlListView_AddItem($List1, "Item2")

Basically : If I select item 1 and press the button I want to type in CMD a certain comand like : "ping \\siemens\local\887393"

And another issue is that I need to store 3 strings list item... 1 button will query 1 button will ping and 1 button will send a reset services command. So I need to be able to store 3 strings on 1 list item and call it on button press.

EX :

item 1  $1 = query $2 = ping  $3= reset services

item 2  $1 = query another server $2 = pinganother server  $3= reset services another server

When selecting " item1 " I want to send one of those $1,$2,$3 on button press.

Thank you.

 

Edited by LionSin
Link to comment
Share on other sites

  • Solution

Didn't really understand what you were asking, did you mean something like:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GUIListView.au3>
#include <WindowsConstants.au3>

Local $iIndex, $sAction, $sCmd
GUICreate("Form1", 332, 267, 192, 124)
Local $idListview = GUICtrlCreateListView("Query|Ping|Reset", 10, 10, 250, 175)
    GUICtrlCreateListViewItem("server1qry|server1ping|service1reset", $idListview)
    GUICtrlCreateListViewItem("server2qry|server2ping|service2reset", $idListview)
Local $idActions = GUICtrlCreateCombo("", 10, 190, 100, 20)
    GUICtrlSetData($idActions, "Query|Ping|Reset", "Query")
Local $Button1 = GUICtrlCreateButton("Button1", 10, 215, 100, 30)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $iIndex = Number(_GUICtrlListView_GetSelectedIndices($idListview))
            $sAction = GUICtrlRead($idActions)
            Switch $sAction
                Case "Query"
                    $sCmd = "Query " & _GUICtrlListView_GetItemText($idListview, $iIndex, 0)
                Case "Ping"
                    $sCmd = "Ping " & _GUICtrlListView_GetItemText($idListview, $iIndex, 1)
                Case "Reset"
                    $sCmd = "Reset " & _GUICtrlListView_GetItemText($idListview, $iIndex, 2)
                Case Else
                    ContinueLoop
            EndSwitch
            WinActivate("Command Prompt")
            WinWaitActive("Command Prompt")
            Send($sCmd)
    EndSwitch
WEnd

 

Link to comment
Share on other sites

3 hours ago, LionSin said:

When selecting " item1 " I want to send one of those $1,$2,$3 on button press.

Usually 1 button => 1 action
It looks overcomplicated. Why not use a simple list of servers (list, combo, etc) along with 3 checkboxes allowing to choose the wanted action(s) (query, ping and/or reset) to execute on button press ?

Edited by mikell
Link to comment
Share on other sites

1 hour ago, Subz said:

Didn't really understand what you were asking, did you mean something like:

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GUIListView.au3>
#include <WindowsConstants.au3>

Local $iIndex, $sAction, $sCmd
GUICreate("Form1", 332, 267, 192, 124)
Local $idListview = GUICtrlCreateListView("Query|Ping|Reset", 10, 10, 250, 175)
    GUICtrlCreateListViewItem("server1qry|server1ping|service1reset", $idListview)
    GUICtrlCreateListViewItem("server2qry|server2ping|service2reset", $idListview)
Local $idActions = GUICtrlCreateCombo("", 10, 190, 100, 20)
    GUICtrlSetData($idActions, "Query|Ping|Reset", "Query")
Local $Button1 = GUICtrlCreateButton("Button1", 10, 215, 100, 30)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $iIndex = Number(_GUICtrlListView_GetSelectedIndices($idListview))
            $sAction = GUICtrlRead($idActions)
            Switch $sAction
                Case "Query"
                    $sCmd = "Query " & _GUICtrlListView_GetItemText($idListview, $iIndex, 0)
                Case "Ping"
                    $sCmd = "Ping " & _GUICtrlListView_GetItemText($idListview, $iIndex, 1)
                Case "Reset"
                    $sCmd = "Reset " & _GUICtrlListView_GetItemText($idListview, $iIndex, 2)
                Case Else
                    ContinueLoop
            EndSwitch
            WinActivate("Command Prompt")
            WinWaitActive("Command Prompt")
            Send($sCmd)
    EndSwitch
WEnd

 

Nice way to think around it. It worked well. The issue I face now is that I need to add a text with " inside.

GUICtrlCreateListViewItem("server pharser|sc "\\siemens" query "trb P001 hlj HP Parser|sc "\\siemens" stop "trb P001 hlj HP Parser|sc "\\siemens" start "trb P001 hlj HP Parser", $idListview)

Did try : 

GUICtrlCreateListViewItem("server pharser|'sc "\\siemens" query "trb P001 hlj HP Parser'|'sc "\\siemens" stop "trb P001 hlj HP Parser'|'sc "\\siemens" start "trb P001 hlj HP Parser'", $idListview)

GUICtrlCreateListViewItem("server pharser|'"sc "\\siemens" query "trb P001 hlj HP Parser"'|"'sc "\\siemens" stop "trb P001 hlj HP Parser"'|'"sc "\\siemens" start "trb P001 hlj HP Parser"'", $idListview)

None working

 

Link to comment
Share on other sites

The other way is to write the cmd output to your gui, for instance:

#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <FontConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GUIListView.au3>
#include <GuiRichEdit.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>

Local $iIndex, $sAction, $sCmd
Local $hWnd = GUICreate("Form1", 550, 355)
Local $idListview = GUICtrlCreateListView("Query|Ping|Reset", 10, 10, 530, 175)
GUICtrlCreateListViewItem('server1qry|"' & @ComputerName & '"|service1reset', $idListview)
GUICtrlCreateListViewItem("server2qry|server2ping|service2reset", $idListview)
Local $idActions = GUICtrlCreateCombo("", 10, 190, 100, 20, $CBS_DROPDOWNLIST)
    GUICtrlSetData($idActions, "Query|Ping|Reset", "Query")
Local $Button1 = GUICtrlCreateButton("Button1", 115, 189, 100, 23)
Local $idEdit = _GUICtrlRichEdit_CreateEx($hWnd, "", 10, 220, 530, 125, Bitor($ES_MULTILINE, $ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY))
    _GUICtrlRichEdit_SetBkColor($idEdit, 0xEEEEEE)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $iIndex = Number(_GUICtrlListView_GetSelectedIndices($idListview))
            $sAction = GUICtrlRead($idActions)
            Switch $sAction
                Case "Query"
                    $sCmd = "Query " & _GUICtrlListView_GetItemText($idListview, $iIndex, 0)
                Case "Ping"
                    $sCmd = "Ping " & _GUICtrlListView_GetItemText($idListview, $iIndex, 1)
                Case "Reset"
                    $sCmd = "Reset " & _GUICtrlListView_GetItemText($idListview, $iIndex, 2)
                Case Else
                    ContinueLoop
            EndSwitch
            Local $iPID = Run(@ComSpec & ' /c ' & $sCmd, "", @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD))
            _GUICtrlRichEdit_AppendText($idEdit, $sCmd & @CRLF)
            Local $sOutput = ""
            While 1
                $sOutput &= StdoutRead($iPID)
                If @error Then ExitLoop
            WEnd
            While 1
                $sOutput &= StderrRead($iPID)
                If @error Then ExitLoop
            WEnd
            _GUICtrlRichEdit_AppendText($idEdit, StringStripWS($sOutput,7) & @CRLF)
            _GUICtrlRichEdit_ScrollToCaret($idEdit)
    EndSwitch
WEnd
Func _GUICtrlRichEdit_CreateEx($hWnd, $sText, $iLeft, $iTop, $iWidth = 150, $iHeight = 150, $iStyle = -1, $iExStyle = -1)
  Local $hCtrl = _GUICtrlRichEdit_Create($hWnd, $sText, $iLeft, $iTop, $iWidth, $iHeight, $iStyle, $iExStyle)
  If @error Then Return SetError(@error)
  Local $hFont = _WinAPI_CreateFont(14, 0, 0, 0, 600, False, False, False, $DEFAULT_CHARSET, _
        $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, "Consolas")
  _SendMessage($hCtrl, $WM_SETFONT, $hFont, True)
  _WinAPI_DeleteObject($hFont)
  Return $hCtrl
EndFunc

 

Link to comment
Share on other sites

One other thing that I normally do in these situations is to use an external csv file or text file, which I write using Excel

For example: Servers.txt

Query "Server1"|Ping "Server1"|Reset "Service1"
Query "Server2"|Ping "Server2"|Reset "Service2"
Query "Server3"|Ping "Server3"|Reset "Service3"
Query "Server4"|Ping "Server4"|Reset "Service4"
Query "Server5"|Ping "Server5"|Reset "Service5"
Query "Server6"|Ping "Server6"|Reset "Service6"
Query "Server7"|Ping "Server7"|Reset "Service7"
Query "Server8"|Ping "Server8"|Reset "Service8"
Query "Server9"|Ping "Server9"|Reset "Service9"
Query "Server10"|Ping "Server10"|Reset "Service10"

Then simply read the file into an array and add directly to the listview, this way you can modify the commands without recompiling your script

#include <Array.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <File.au3>
#include <FontConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GUIListView.au3>
#include <GuiRichEdit.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>

Local $aServers
    _FileReadToArray(@ScriptDir & "\Servers.txt", $aServers, 0, "|")
    If @error Then Exit MsgBox(16, "Error", "Unable to read Servers.txt to an array.")
Local $iIndex, $sAction, $sCmd
Local $hWnd = GUICreate("Form1", 550, 355)
Local $idListview = GUICtrlCreateListView("Query|Ping|Reset", 10, 10, 530, 175)
    _GUICtrlListView_AddArray($idListview, $aServers)
    _GUICtrlListView_SetColumnWidth($idListview, 0, 150)
    _GUICtrlListView_SetColumnWidth($idListview, 1, 150)
    _GUICtrlListView_SetColumnWidth($idListview, 2, $LVSCW_AUTOSIZE_USEHEADER)
Local $idActions = GUICtrlCreateCombo("", 10, 190, 100, 20, $CBS_DROPDOWNLIST)
    GUICtrlSetData($idActions, "Query|Ping|Reset", "Ping")
Local $Button1 = GUICtrlCreateButton("Button1", 115, 189, 100, 23)
Local $idEdit = _GUICtrlRichEdit_CreateEx($hWnd, "", 10, 220, 530, 125, Bitor($ES_MULTILINE, $ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY))
    _GUICtrlRichEdit_SetBkColor($idEdit, 0xEEEEEE)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $iIndex = Number(_GUICtrlListView_GetSelectedIndices($idListview))
            $sAction = GUICtrlRead($idActions)
            Switch $sAction
                Case "Query"
                    $sCmd = _GUICtrlListView_GetItemText($idListview, $iIndex, 0)
                Case "Ping"
                    $sCmd = _GUICtrlListView_GetItemText($idListview, $iIndex, 1)
                Case "Reset"
                    $sCmd = _GUICtrlListView_GetItemText($idListview, $iIndex, 2)
                Case Else
                    ContinueLoop
            EndSwitch
            Local $iPID = Run(@ComSpec & ' /c ' & $sCmd, "", @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD))
            _GUICtrlRichEdit_AppendText($idEdit, $sCmd & @CRLF)
            Local $sOutput = ""
            While 1
                $sOutput &= StdoutRead($iPID)
                If @error Then ExitLoop
            WEnd
            While 1
                $sOutput &= StderrRead($iPID)
                If @error Then ExitLoop
            WEnd
            _GUICtrlRichEdit_AppendText($idEdit, StringStripWS($sOutput,7) & @CRLF)
            _GUICtrlRichEdit_ScrollToCaret($idEdit)
    EndSwitch
WEnd
Func _GUICtrlRichEdit_CreateEx($hWnd, $sText, $iLeft, $iTop, $iWidth = 150, $iHeight = 150, $iStyle = -1, $iExStyle = -1)
  Local $hCtrl = _GUICtrlRichEdit_Create($hWnd, $sText, $iLeft, $iTop, $iWidth, $iHeight, $iStyle, $iExStyle)
  If @error Then Return SetError(@error)
  Local $hFont = _WinAPI_CreateFont(14, 0, 0, 0, 600, False, False, False, $DEFAULT_CHARSET, _
        $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, "Consolas")
  _SendMessage($hCtrl, $WM_SETFONT, $hFont, True)
  _WinAPI_DeleteObject($hFont)
  Return $hCtrl
EndFunc

 

Link to comment
Share on other sites

13 hours ago, Subz said:

One other thing that I normally do in these situations is to use an external csv file or text file, which I write using Excel

For example: Servers.txt

Query "Server1"|Ping "Server1"|Reset "Service1"
Query "Server2"|Ping "Server2"|Reset "Service2"
Query "Server3"|Ping "Server3"|Reset "Service3"
Query "Server4"|Ping "Server4"|Reset "Service4"
Query "Server5"|Ping "Server5"|Reset "Service5"
Query "Server6"|Ping "Server6"|Reset "Service6"
Query "Server7"|Ping "Server7"|Reset "Service7"
Query "Server8"|Ping "Server8"|Reset "Service8"
Query "Server9"|Ping "Server9"|Reset "Service9"
Query "Server10"|Ping "Server10"|Reset "Service10"

Then simply read the file into an array and add directly to the listview, this way you can modify the commands without recompiling your script

#include <Array.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <File.au3>
#include <FontConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GUIListView.au3>
#include <GuiRichEdit.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>

Local $aServers
    _FileReadToArray(@ScriptDir & "\Servers.txt", $aServers, 0, "|")
    If @error Then Exit MsgBox(16, "Error", "Unable to read Servers.txt to an array.")
Local $iIndex, $sAction, $sCmd
Local $hWnd = GUICreate("Form1", 550, 355)
Local $idListview = GUICtrlCreateListView("Query|Ping|Reset", 10, 10, 530, 175)
    _GUICtrlListView_AddArray($idListview, $aServers)
    _GUICtrlListView_SetColumnWidth($idListview, 0, 150)
    _GUICtrlListView_SetColumnWidth($idListview, 1, 150)
    _GUICtrlListView_SetColumnWidth($idListview, 2, $LVSCW_AUTOSIZE_USEHEADER)
Local $idActions = GUICtrlCreateCombo("", 10, 190, 100, 20, $CBS_DROPDOWNLIST)
    GUICtrlSetData($idActions, "Query|Ping|Reset", "Ping")
Local $Button1 = GUICtrlCreateButton("Button1", 115, 189, 100, 23)
Local $idEdit = _GUICtrlRichEdit_CreateEx($hWnd, "", 10, 220, 530, 125, Bitor($ES_MULTILINE, $ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY))
    _GUICtrlRichEdit_SetBkColor($idEdit, 0xEEEEEE)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $iIndex = Number(_GUICtrlListView_GetSelectedIndices($idListview))
            $sAction = GUICtrlRead($idActions)
            Switch $sAction
                Case "Query"
                    $sCmd = _GUICtrlListView_GetItemText($idListview, $iIndex, 0)
                Case "Ping"
                    $sCmd = _GUICtrlListView_GetItemText($idListview, $iIndex, 1)
                Case "Reset"
                    $sCmd = _GUICtrlListView_GetItemText($idListview, $iIndex, 2)
                Case Else
                    ContinueLoop
            EndSwitch
            Local $iPID = Run(@ComSpec & ' /c ' & $sCmd, "", @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD))
            _GUICtrlRichEdit_AppendText($idEdit, $sCmd & @CRLF)
            Local $sOutput = ""
            While 1
                $sOutput &= StdoutRead($iPID)
                If @error Then ExitLoop
            WEnd
            While 1
                $sOutput &= StderrRead($iPID)
                If @error Then ExitLoop
            WEnd
            _GUICtrlRichEdit_AppendText($idEdit, StringStripWS($sOutput,7) & @CRLF)
            _GUICtrlRichEdit_ScrollToCaret($idEdit)
    EndSwitch
WEnd
Func _GUICtrlRichEdit_CreateEx($hWnd, $sText, $iLeft, $iTop, $iWidth = 150, $iHeight = 150, $iStyle = -1, $iExStyle = -1)
  Local $hCtrl = _GUICtrlRichEdit_Create($hWnd, $sText, $iLeft, $iTop, $iWidth, $iHeight, $iStyle, $iExStyle)
  If @error Then Return SetError(@error)
  Local $hFont = _WinAPI_CreateFont(14, 0, 0, 0, 600, False, False, False, $DEFAULT_CHARSET, _
        $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, "Consolas")
  _SendMessage($hCtrl, $WM_SETFONT, $hFont, True)
  _WinAPI_DeleteObject($hFont)
  Return $hCtrl
EndFunc

 

I managed to modify the first code and used some of the second you posted to complete the program :) Worked like a charm.

Now I need to find a way to make it run CMD on startup as a different user... 

#reqadmin is not working..  because the user is a local Admin.  Basically I need to simulate  "" Shift + Rightclick on CMD then " Run as another user " 

Link to comment
Share on other sites

15 hours ago, Subz said:

One other thing that I normally do in these situations is to use an external csv file or text file, which I write using Excel

For example: Servers.txt

Query "Server1"|Ping "Server1"|Reset "Service1"
Query "Server2"|Ping "Server2"|Reset "Service2"
Query "Server3"|Ping "Server3"|Reset "Service3"
Query "Server4"|Ping "Server4"|Reset "Service4"
Query "Server5"|Ping "Server5"|Reset "Service5"
Query "Server6"|Ping "Server6"|Reset "Service6"
Query "Server7"|Ping "Server7"|Reset "Service7"
Query "Server8"|Ping "Server8"|Reset "Service8"
Query "Server9"|Ping "Server9"|Reset "Service9"
Query "Server10"|Ping "Server10"|Reset "Service10"

Then simply read the file into an array and add directly to the listview, this way you can modify the commands without recompiling your script

#include <Array.au3>
#include <ButtonConstants.au3>
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <File.au3>
#include <FontConstants.au3>
#include <GUIConstantsEx.au3>
#include <GUIListBox.au3>
#include <GUIListView.au3>
#include <GuiRichEdit.au3>
#include <WinAPIGdi.au3>
#include <WindowsConstants.au3>

Local $aServers
    _FileReadToArray(@ScriptDir & "\Servers.txt", $aServers, 0, "|")
    If @error Then Exit MsgBox(16, "Error", "Unable to read Servers.txt to an array.")
Local $iIndex, $sAction, $sCmd
Local $hWnd = GUICreate("Form1", 550, 355)
Local $idListview = GUICtrlCreateListView("Query|Ping|Reset", 10, 10, 530, 175)
    _GUICtrlListView_AddArray($idListview, $aServers)
    _GUICtrlListView_SetColumnWidth($idListview, 0, 150)
    _GUICtrlListView_SetColumnWidth($idListview, 1, 150)
    _GUICtrlListView_SetColumnWidth($idListview, 2, $LVSCW_AUTOSIZE_USEHEADER)
Local $idActions = GUICtrlCreateCombo("", 10, 190, 100, 20, $CBS_DROPDOWNLIST)
    GUICtrlSetData($idActions, "Query|Ping|Reset", "Ping")
Local $Button1 = GUICtrlCreateButton("Button1", 115, 189, 100, 23)
Local $idEdit = _GUICtrlRichEdit_CreateEx($hWnd, "", 10, 220, 530, 125, Bitor($ES_MULTILINE, $ES_WANTRETURN, $WS_VSCROLL, $ES_AUTOVSCROLL, $ES_READONLY))
    _GUICtrlRichEdit_SetBkColor($idEdit, 0xEEEEEE)
GUISetState(@SW_SHOW)

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button1
            $iIndex = Number(_GUICtrlListView_GetSelectedIndices($idListview))
            $sAction = GUICtrlRead($idActions)
            Switch $sAction
                Case "Query"
                    $sCmd = _GUICtrlListView_GetItemText($idListview, $iIndex, 0)
                Case "Ping"
                    $sCmd = _GUICtrlListView_GetItemText($idListview, $iIndex, 1)
                Case "Reset"
                    $sCmd = _GUICtrlListView_GetItemText($idListview, $iIndex, 2)
                Case Else
                    ContinueLoop
            EndSwitch
            Local $iPID = Run(@ComSpec & ' /c ' & $sCmd, "", @SW_HIDE, BitOR($STDERR_CHILD, $STDOUT_CHILD))
            _GUICtrlRichEdit_AppendText($idEdit, $sCmd & @CRLF)
            Local $sOutput = ""
            While 1
                $sOutput &= StdoutRead($iPID)
                If @error Then ExitLoop
            WEnd
            While 1
                $sOutput &= StderrRead($iPID)
                If @error Then ExitLoop
            WEnd
            _GUICtrlRichEdit_AppendText($idEdit, StringStripWS($sOutput,7) & @CRLF)
            _GUICtrlRichEdit_ScrollToCaret($idEdit)
    EndSwitch
WEnd
Func _GUICtrlRichEdit_CreateEx($hWnd, $sText, $iLeft, $iTop, $iWidth = 150, $iHeight = 150, $iStyle = -1, $iExStyle = -1)
  Local $hCtrl = _GUICtrlRichEdit_Create($hWnd, $sText, $iLeft, $iTop, $iWidth, $iHeight, $iStyle, $iExStyle)
  If @error Then Return SetError(@error)
  Local $hFont = _WinAPI_CreateFont(14, 0, 0, 0, 600, False, False, False, $DEFAULT_CHARSET, _
        $OUT_DEFAULT_PRECIS, $CLIP_DEFAULT_PRECIS, $DEFAULT_QUALITY, 0, "Consolas")
  _SendMessage($hCtrl, $WM_SETFONT, $hFont, True)
  _WinAPI_DeleteObject($hFont)
  Return $hCtrl
EndFunc

 

Did approach this Ideea. Works amazing, allso solved my problem with different domain users. After Compile, they can just Shift + right click the application and run it as a different user. Thank you so much for the different approaches you tought me.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...