Jump to content

GUI for PSEXEC


dave
 Share

Recommended Posts

I created this after seeing screen shots of similar app that is no longer available. It works just fine but wondering if there are some things I could of done differently/more effeciently.

#include <ButtonConstants.au3>

#include <EditConstants.au3>

#include <GUIConstantsEx.au3>

#include <StaticConstants.au3>

#include <StatusBarConstants.au3>

#include <TabConstants.au3>

#include <WindowsConstants.au3>

#include <array.au3>

#Include <GuiListView.au3>

#include <file.au3>

#include <GuiTab.au3>

#include <IE.au3>

;copies psexec to temp dir so that psexec is not required on computer

FileInstall('C:\drivers\pstools\psexec.exe', @TempDir&'\psexec.exe', 1)

$PS = 'psexec.exe'

$TO = ' -n 60'

$TOOLS = GUICreate("PSexec GUI", 532, 380, -1, -1)

$App = GUICtrlCreateInput("", 8, 24, 201, 21)

$Browse1 = GUICtrlCreateButton("Browse", 218, 23, 75, 23, 0)

$PL2 = GUICtrlCreateLabel("Application to run on remote PC", 8, 6, 184, 17)

GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

$CLO = GUICtrlCreateInput("", 8, 76, 289, 21)

$PL3 = GUICtrlCreateLabel("Command line parameters", 8, 56, 148, 17)

GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

$PL4 = GUICtrlCreateLabel("Admin user name", 8, 106, 124, 17)

GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

$PL5 = GUICtrlCreateLabel("Password", 160, 106, 74, 17)

GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")

$Usrnm = GUICtrlCreateInput("", 8, 128, 137, 21)

$Pw = GUICtrlCreateInput("", 160, 128, 137, 21, $ES_PASSWORD)

$Group1 = GUICtrlCreateGroup("Parameters", 8, 168, 289, 205)

$PCH1 = GUICtrlCreateCheckbox("Interact with the users desktop", 16, 184, 185, 17)

$PCH2 = GUICtrlCreateCheckbox("Run application in the system account", 16, 208, 225, 17)

$PCH3 = GUICtrlCreateCheckbox("Copy file to remote", 16, 232, 113, 17)

$Group2 = GUICtrlCreateGroup("Copy Options", 20, 248, 250, 54)

$PCH4 = GUICtrlCreateRadio("Overwrite existing file", 28, 263, 121, 17)

GUICtrlSetState(-1, $GUI_CHECKED)

$PCH5 = GUICtrlCreateRadio("Copy file only if it is a higher version or newer", 28, 280, 241, 17)

$PCH6 = GUICtrlCreateCheckbox("Don't wait for the process to terminate", 16, 304, 225, 17)

$PCH7 = GUICtrlCreateCheckbox("Show output window", 16, 328, 129, 17)

$PL11 = GUICtrlCreateLabel("Thread priority:", 16, 350, 74, 17)

$PR1 = GUICtrlCreateRadio("Low", 96, 348, 49, 17)

$PR2 = GUICtrlCreateRadio("Normal", 152, 348, 57, 17)

GUICtrlSetState ($PR2, $GUI_CHECKED)

$PR3 = GUICtrlCreateRadio("High", 216, 348, 49, 17)

GUICtrlCreateGroup("", -99, -99, 1, 1)

$PT1 = GUICtrlCreateTab(304, 8, 217, 313)

GUICtrlSetResizing(-1, $GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)

$PTS1 = GUICtrlCreateTabItem("Enter Name")

$RPC = GUICtrlCreateInput("", 312, 56, 137, 21)

$PL6 = GUICtrlCreateLabel("Remote PC name (or add PC to the list)", 312, 32, 188, 17)

$Add = GUICtrlCreateButton("Add", 456, 54, 41, 25, 0)

$List1 = GUICtrlCreateListView("", 310, 85, 200, 200, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT, $WS_VSCROLL))

_GUICtrlListView_InsertColumn($List1, 0, "Machine name or IP", 200)

_GUICtrlListView_SetExtendedListViewStyle($List1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))

$Rms1 = GUICtrlCreateButton("Remove from list", 310, 287, 100, 25, 0)

$Clr1 = GUICtrlCreateButton("Clear list", 440, 287, 70, 25, 0)

$PTS2 = GUICtrlCreateTabItem("Load PC List")

$PL7 = GUICtrlCreateLabel("Load text file (one pc name per line)", 312, 34, 172, 17)

$CL = GUICtrlCreateInput("", 312, 56, 121, 21)

$Browse2 = GUICtrlCreateButton("Browse", 435, 54, 41, 25, 0)

$Load = GUICtrlCreateButton("Load", 476, 54, 41, 25, 0)

$List2 = GUICtrlCreateListView("", 310, 85, 200, 200, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT, $WS_VSCROLL))

_GUICtrlListView_InsertColumn($List2, 0, "Machine name or IP", 200)

_GUICtrlListView_SetExtendedListViewStyle($List2, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))

$Rms2 = GUICtrlCreateButton("Remove from list", 310, 287, 100, 25, 0)

$Clr2 = GUICtrlCreateButton("Clear list", 440, 287, 70, 25, 0)

;$PTS3 = GUICtrlCreateTabItem("Browse Net")

GUICtrlCreateTabItem("")

$HLP = GUICtrlCreateButton("Help", 305, 328, 75, 25, 0)

$EX = GUICtrlCreateButton("Execute", 445, 328, 75, 25, 0)

GUICtrlSetState(-1, $GUI_DROPACCEPTED)

GUISetState(@SW_SHOW)

While 1

$nMsg = GUIGetMsg()

Switch $nMsg

Case $GUI_EVENT_CLOSE

ExitLoop

Case $Browse1

;If browse buttong is selected will read selection and set data to input box

$browse11 = FileOpenDialog ("Browse", "C:\", "All Files (*.*)")

Guictrlsetdata ($App, $browse11)

Case $Add

;check if remote computer was specified

$PC = GUICtrlRead($RPC)

_GUICtrlListView_AddItem($list1, $PC)

Case $Clr1

;Clears list1 on Enter name tab if clear button is pressed

Clear($list1)

Case $Clr2

;Clears list2 on Enter name tab if clear button is pressed

Clear($list2)

Case $Browse2

;If load button is selected will read selection and set data to input box

$Browse22 = FileOpenDialog ("Browse", "C:\", "All Files (*.*)")

Guictrlsetdata ($CL, $Browse22)

$PCL = GUICtrlRead($CL)

Case $Load

;loads file for load pc list tab list2 box

load($PCL)

Case $Rms1

;removes selected item

_GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($list1))

Case $Rms2

;removes selected item

_GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($list2))

Case $HLP

_IECreate('http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx')

Case $EX

;reads app input box

$AP = GUICtrlRead($App)

;checks if alternate username was specified

$USN = GUICtrlRead($Usrnm)

If $USN <> '' Then

$USN = '-u '&GUICtrlRead($Usrnm)

$PAS = ' -p '&GUICtrlRead($Pw)

Else

$USN = ''

$PAS = ''

EndIf

;sees if don't wait for process is checked

$C6 = GUICtrlRead($PCH6)

If $C6 = 1 Then

$d = ' -d'

Else

$d = ''

EndIf

;sees if copy file to remote pc was checked

$C3 = GUICtrlRead($PCH3)

If $C3 = 1 Then

$c = ' -c'

Else

$c = ''

EndIf

;sees if copy if newer version or date is checked

$C5 = GUICtrlRead($PCH5)

If 1 = $C5 And 1 = $C3 Then

$v = ' -v'

Else

$v = ''

EndIf

;sees if force overwrite is checked

$C4 = GUICtrlRead($PCH4)

If 1 = $C4 And 1 = $C3 Then

$f = ' -f'

Else

$f = ''

EndIf

;sees if run under system account is checked

$C2 = GUICtrlRead($PCH2)

If 1 = $C2 Then

$s = ' -s'

Else

$s = ''

EndIf

;sees if interact with desktop is checked

$C1 = GUICtrlRead($PCH1)

If 1 = $C1 Then

$i = ' -i'

Else

$i = ''

EndIf

;reads any command line options were specified

$CO = GUICtrlRead($CLO)

;sees what priority was selected

$P1 = GUICtrlRead($PR1)

$P2 = GUICtrlRead($PR2)

$P3 = GUICtrlRead($PR3)

If $P1 = 1 Then

$P = ' -low'

ElseIf $P2 = 1 Then

$P = ' -normal'

ElseIf $P3 = 1 Then

$P = ' -high'

EndIf

;sees is display output was selected

$C7 = GUICtrlRead($PCH7)

If $C7 == 1 Then

$sd = @SW_SHOW

Else

$sd = @SW_HIDE

EndIf

;Execution loop

While 2

If $AP = '' Then

MsgBox(0,"", "No application was specified")

ExitLoop

Else

;depending on what tab is selected sets the correct list box

If _GUICtrlTab_GetItemState($PT1, 1) = 0 Then

;BuildArray($list1)

$list = $list1

ElseIf _GUICtrlTab_GetItemState($PT1, 1) = 1 Then

;BuildArray($list2)

$list = $list2

EndIf

$IC = _GUICtrlListView_GetItemCount($list)

For $item = 0 To $IC - 1

$FL = @ComSpec &' /c psexec.exe \\'&_GUICtrlListView_GetItemText(GUICtrlGetHandle($list), $item)&' '&$USN&' (pass is not logged)'&$TO&$s&$i&$c&$v&$f&$d&$P&' "'&$AP&'" '&$CO

_FileWriteLog(@TempDir&'\PSexec.log', $FL)

RunWait(@ComSpec &' /c psexec.exe \\'&_GUICtrlListView_GetItemText(GUICtrlGetHandle($list), $item)&' '&$USN&$PAS&$TO&$s&$i&$c&$v&$f&$d&$P&' "'&$AP&'" '&$CO&' >>'&@TempDir&'\psexeccommand.'&_GUICtrlListView_GetItemText(GUICtrlGetHandle($list), $item)&'.log', @TempDir, $sd)

Next

EndIf

;asks if the user would like to execute

If 6 = MsgBox(4,'PSexec GUI', 'Done executing, do you want to exit?') Then

Exit

Else

;clears both lists if users selects yes

If 6 = MsgBox(4, 'PSexec GUI', 'Do you want to clear the computer list?') Then

Clear($list1)

Clear($list2)

ExitLoop

Else

ExitLoop

EndIf

EndIf

WEnd

EndSwitch

WEnd

;load pc list from text file

Func Load($list)

$file = FileOpen($list, 0)

If $file = -1 Then

MsgBox(0, 'Error', 'Unable To open file')

EndIf

While 2

$FRPCL = FileReadLine($file)

If @error = -1 Then ExitLoop

_GUICtrlListView_AddItem($List2, $FRPCL)

WEnd

EndFunc

;clears array and list

Func Clear($listview)

_GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($listview))

EndFunc

Link to comment
Share on other sites

Check this out.

http://www.autoitscript.com/forum/index.ph...mp;#entry428991

old code, needs updating. Add #include EditConstants.au3 to script and ignore errors just to get an idea of the gui. Not a complete working solution.

Edited by spudw2k
Link to comment
Share on other sites

  • 1 month later...
  • 1 month later...

Great script. I have made a few changes to it and thought I would share. The changes add domain/workstation functionality as well as integrates the domain name or workstation name into a list of pc's either from the main window or an imported text file.

It will also integrate the file psexec.exe into the compiled program. Make sure it is in the same folder as the script file.

Enjoy.

#Region
#AutoIt3Wrapper_Res_File_Add=psexec.exe
#EndRegion
#include <ButtonConstants.au3>
#include <ButtonConstants.au3>
#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <StatusBarConstants.au3>
#include <TabConstants.au3>
#include <WindowsConstants.au3>
#include <array.au3>
#include <GuiListView.au3>
#include <file.au3>
#include <GuiTab.au3>
#include <IE.au3>

$PS = 'psexec.exe'
$TO = ' -n 60'

$TOOLS = GUICreate("PSexec GUI", 532, 420, -1, -1)
$App = GUICtrlCreateInput("", 8, 24, 201, 21)
$Browse1 = GUICtrlCreateButton("Browse", 218, 23, 75, 23, 0)
$PL2 = GUICtrlCreateLabel("Application to run on remote PC", 8, 6, 184, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$CLO = GUICtrlCreateInput("", 8, 67, 289, 21)
$PL3 = GUICtrlCreateLabel("Command line parameters", 8, 50, 148, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$PL4 = GUICtrlCreateLabel("Admin User Name", 8, 100, 124, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$PL5 = GUICtrlCreateLabel("Admin Password", 8, 120, 124, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$PL8 = GUICtrlCreateLabel("Domain/Workstation", 8, 140, 124, 17)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
$PCH8 = GUICtrlCreateCheckbox("Use Workstation ID (list mode)", 16, 158, 225, 17)
$Usrnm = GUICtrlCreateInput("", 140, 96, 157, 21)
$Pw = GUICtrlCreateInput("", 140, 116, 157, 21, $ES_PASSWORD)
$Domain = GUICtrlCreateInput("", 140, 136, 157, 21)
$Group1 = GUICtrlCreateGroup("Parameters", 8, 178, 289, 216)
$PCH1 = GUICtrlCreateCheckbox("Interact with the users desktop", 16, 194, 185, 17)
$PCH2 = GUICtrlCreateCheckbox("Run application in the system account", 16, 218, 225, 17)
$PCH3 = GUICtrlCreateCheckbox("Copy file to remote", 16, 242, 113, 17)
$Group2 = GUICtrlCreateGroup("Copy Options", 20, 265, 250, 54)
$PCH4 = GUICtrlCreateRadio("Overwrite existing file", 28, 278, 121, 17)
GUICtrlSetState(-1, $GUI_CHECKED)
$PCH5 = GUICtrlCreateRadio("Copy file only if it is a higher version or newer", 28, 295, 241, 17)
$PCH6 = GUICtrlCreateCheckbox("Don't wait for the process to terminate", 16, 325, 225, 17)
$PCH7 = GUICtrlCreateCheckbox("Show output window", 16, 344, 129, 17)
$PL11 = GUICtrlCreateLabel("Thread priority:", 16, 370, 74, 17)
$PR1 = GUICtrlCreateRadio("Low", 96, 368, 49, 17)
$PR2 = GUICtrlCreateRadio("Normal", 152, 368, 57, 17)
GUICtrlSetState($PR2, $GUI_CHECKED)
$PR3 = GUICtrlCreateRadio("High", 216, 368, 49, 17)
GUICtrlCreateGroup("", -99, -99, 1, 1)
$PT1 = GUICtrlCreateTab(304, 8, 217, 313)
GUICtrlSetResizing(-1, $GUI_DOCKWIDTH + $GUI_DOCKHEIGHT)
$PTS1 = GUICtrlCreateTabItem("Enter Name")
$RPC = GUICtrlCreateInput("", 312, 56, 137, 21)
$PL6 = GUICtrlCreateLabel("Remote PC name (or add PC to the list)", 312, 32, 188, 17)
$Add = GUICtrlCreateButton("Add", 456, 54, 41, 25, 0)
$List1 = GUICtrlCreateListView("", 310, 85, 200, 200, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT, $WS_VSCROLL))
_GUICtrlListView_InsertColumn($List1, 0, "Machine name or IP", 200)
_GUICtrlListView_SetExtendedListViewStyle($List1, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
$Rms1 = GUICtrlCreateButton("Remove from list", 310, 287, 100, 25, 0)
$Clr1 = GUICtrlCreateButton("Clear list", 440, 287, 70, 25, 0)
$PTS2 = GUICtrlCreateTabItem("Load PC List")
$PL7 = GUICtrlCreateLabel("Load text file (one pc name per line)", 312, 34, 172, 17)
$CL = GUICtrlCreateInput("", 312, 56, 121, 21)
$Browse2 = GUICtrlCreateButton("Browse", 435, 54, 41, 25, 0)
$Load = GUICtrlCreateButton("Load", 476, 54, 41, 25, 0)
$List2 = GUICtrlCreateListView("", 310, 85, 200, 200, BitOR($LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER, $LVS_REPORT, $WS_VSCROLL))
_GUICtrlListView_InsertColumn($List2, 0, "Machine name or IP", 200)
_GUICtrlListView_SetExtendedListViewStyle($List2, BitOR($LVS_EX_GRIDLINES, $LVS_EX_FULLROWSELECT))
$Rms2 = GUICtrlCreateButton("Remove from list", 310, 287, 100, 25, 0)
$Clr2 = GUICtrlCreateButton("Clear list", 440, 287, 70, 25, 0)
;$PTS3 = GUICtrlCreateTabItem("Browse Net")
GUICtrlCreateTabItem("")
$HLP = GUICtrlCreateButton("Help", 305, 328, 75, 25, 0)
$EX = GUICtrlCreateButton("Execute", 445, 328, 75, 25, 0)
GUICtrlSetState(-1, $GUI_DROPACCEPTED)
GUISetState(@SW_SHOW)


While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Browse1
            ;If browse buttong is selected will read selection and set data to input box
            $browse11 = FileOpenDialog("Browse", "C:\", "All Files (*.*)")
            GUICtrlSetData($App, $browse11)
        Case $Add
            ;check if remote computer was specified
            $PC = GUICtrlRead($RPC)
            _GUICtrlListView_AddItem($List1, $PC)
        Case $Clr1
            ;Clears list1 on Enter name tab if clear button is pressed
            Clear($List1)
        Case $Clr2
            ;Clears list2 on Enter name tab if clear button is pressed
            Clear($List2)
        Case $Browse2
            ;If load button is selected will read selection and set data to input box
            $Browse22 = FileOpenDialog("Browse", "C:\", "All Files (*.*)")
            GUICtrlSetData($CL, $Browse22)
            $PCL = GUICtrlRead($CL)
        Case $Load
            ;loads file for load pc list tab list2 box
            load($PCL)
        Case $Rms1
            ;removes selected item
            _GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($List1))
        Case $Rms2
            ;removes selected item
            _GUICtrlListView_DeleteItemsSelected(GUICtrlGetHandle($List2))
        Case $HLP
            _IECreate('http://technet.microsoft.com/en-us/sysinternals/bb897553.aspx')
        Case $EX
            ;reads app input box
            $AP = GUICtrlRead($App)
            ;sees if don't wait for process is checked
            $C6 = GUICtrlRead($PCH6)
            If $C6 = 1 Then
                $d = ' -d'
            Else
                $d = ''
            EndIf
            ;sees if copy file to remote pc was checked
            $C3 = GUICtrlRead($PCH3)
            If $C3 = 1 Then
                $c = ' -c'
            Else
                $c = ''
            EndIf
            ;sees if copy if newer version or date is checked
            $C5 = GUICtrlRead($PCH5)
            If 1 = $C5 And 1 = $C3 Then
                $v = ' -v'
            Else
                $v = ''
            EndIf
            ;sees if force overwrite is checked
            $C4 = GUICtrlRead($PCH4)
            If 1 = $C4 And 1 = $C3 Then
                $f = ' -f'
            Else
                $f = ''
            EndIf
            ;sees if run under system account is checked
            $C2 = GUICtrlRead($PCH2)
            If 1 = $C2 Then
                $s = ' -s'
            Else
                $s = ''
            EndIf
            ;sees if interact with desktop is checked
            $C1 = GUICtrlRead($PCH1)
            If 1 = $C1 Then
                $i = ' -i'
            Else
                $i = ''
            EndIf
            ;reads any command line options were specified
            $CO = GUICtrlRead($CLO)
            ;sees what priority was selected
            $P1 = GUICtrlRead($PR1)
            $P2 = GUICtrlRead($PR2)
            $P3 = GUICtrlRead($PR3)
            If $P1 = 1 Then
                $P = ' -low'
            ElseIf $P2 = 1 Then
                $P = ' -normal'
            ElseIf $P3 = 1 Then
                $P = ' -high'
            EndIf
            ;sees is display output was selected
            $C7 = GUICtrlRead($PCH7)
            If $C7 == 1 Then
                $sd = @SW_SHOW
            Else
                $sd = @SW_HIDE
            EndIf
            ;sees is workstation id was selected
            $C8 = GUICtrlRead($PCH8)
            If $C8 == 1 Then
                $wstn = 1
            Else
                $wstn = ''
            EndIf
            ;Execution loop
            While 2
                If $AP = '' Then
                    MsgBox(0, "", "No application was specified")
                    ExitLoop
                Else
                    ;depending on what tab is selected sets the correct list box
                    If _GUICtrlTab_GetItemState($PT1, 1) = 0 Then
                        ;BuildArray($list1)
                        $list = $List1
                    ElseIf _GUICtrlTab_GetItemState($PT1, 1) = 1 Then
                        ;BuildArray($list2)
                        $list = $List2
                    EndIf
                    $IC = _GUICtrlListView_GetItemCount($list)
                    For $item = 0 To $IC - 1
                        ;checks if alternate username was specified
                        $USN = GUICtrlRead($Usrnm)
                        If $USN <> '' And $wstn >= '' Then
                            $USN = '-u ' & _GUICtrlListView_GetItemText(GUICtrlGetHandle($list), $item) & '\' & GUICtrlRead($Usrnm)
                            $PAS = ' -p ' & GUICtrlRead($Pw)
                        ElseIf $USN <> '' And $Domain == '' Then
                            $USN = '-u ' & GUICtrlRead($Usrnm)
                            $PAS = ' -p ' & GUICtrlRead($Pw)
                        ElseIf $USN <> '' Then
                            $USN = '-u ' & GUICtrlRead($Domain) & '\' & GUICtrlRead($Usrnm)
                            $PAS = ' -p ' & GUICtrlRead($Pw)
                        Else
                            $USN = ''
                            $PAS = ''
                        EndIf
                        $FL = @ComSpec & ' /c psexec.exe \\' & _GUICtrlListView_GetItemText(GUICtrlGetHandle($list), $item) & ' ' & $USN & ' (pass is not logged)' & $TO & $s & $i & $c & $v & $f & $d & $P & ' "' & $AP & '" ' & $CO
                        _FileWriteLog(@TempDir & '\PSexec.log', $FL)
                        RunWait(@ComSpec & ' /c psexec.exe \\' & _GUICtrlListView_GetItemText(GUICtrlGetHandle($list), $item) & ' ' & $USN & $PAS & $TO & $s & $i & $c & $v & $f & $d & $P & ' "' & $AP & '" ' & $CO & ' >>' & @TempDir & '\psexeccommand.' & _GUICtrlListView_GetItemText(GUICtrlGetHandle($list), $item) & '.log', @TempDir, $sd)
                    Next
                EndIf
                ;asks if the user would like to execute
                If 6 = MsgBox(4, 'PSexec GUI', 'Done executing, do you want to exit?') Then
                    Exit
                Else
                    ;clears both lists if users selects yes
                    If 6 = MsgBox(4, 'PSexec GUI', 'Do you want to clear the computer list?') Then
                        Clear($List1)
                        Clear($List2)
                        ExitLoop
                    Else
                        ExitLoop
                    EndIf
                EndIf
            WEnd
    EndSwitch
WEnd

;load pc list from text file
Func Load($list)
    $file = FileOpen($list, 0)
    If $file = -1 Then
        MsgBox(0, 'Error', 'Unable To open file')
    EndIf
    While 2
        $FRPCL = FileReadLine($file)
        If @error = -1 Then ExitLoop
        _GUICtrlListView_AddItem($List2, $FRPCL)
    WEnd
EndFunc   ;==>Load
;clears array and list
Func Clear($listview)
    _GUICtrlListView_DeleteAllItems(GUICtrlGetHandle($listview))
EndFunc   ;==>Clear
Link to comment
Share on other sites

  • 4 weeks later...

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...