Jump to content

input box help


keilamym
 Share

Recommended Posts

my techs want wants a tool so they can input a list of computer names, then I can have scripts run on each computer.

in one case, I need to run the script on the actual name but in other cases, I need to add a value to the end of the computer name.

For example

Computer1

Comptuer1$

Can someone send me to a sample script or tell which AutoIt command  I would need to research. I've written many autoit scripts but never had to create an inputbox for multiple devices.

maybe I can save the computer list to a tempfile and have the script pull devices from the tempfile?

any and all help is appreciated.

Link to comment
Share on other sites

Basic example

#include <GUIConstantsEx.au3>
#include <GuiEdit.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>

Example()

Func Example()
    GUICreate("listview items", 220, 250)

    Local $idListview = GUICtrlCreateListView("Computers", 10, 10, 200, 150)
    _GUICtrlListView_SetColumnWidth($idListview, 0, $LVSCW_AUTOSIZE_USEHEADER)
    Local $idComputer = GUICtrlCreateInput("", 10, 170, 200, 20)
    _GUICtrlEdit_SetCueBanner($idComputer, "Enter Computer Name")
    Local $idAdd = GUICtrlCreateButton("Add Computer", 10, 195, 95, 20)
    Local $idSuffix = GUICtrlCreateInput("$", 110, 195, 100, 20)
    _GUICtrlEdit_SetCueBanner($idSuffix, "Add Suffix [Optional]")
    Local $idRead = GUICtrlCreateButton("Read List", 10, 220, 200, 20)
    GUISetState(@SW_SHOW)
    While 1
        Switch GUIGetMsg()
            Case $GUI_EVENT_CLOSE
                ExitLoop
            Case $idAdd
                $vSuffix = GUICtrlRead($idSuffix)
                If GUICtrlRead($idComputer) <> "" Then
                    GUICtrlCreateListViewItem(GUICtrlRead($idComputer) & $vSuffix, $idListview)
                EndIf
            Case $idRead
                $iListView = _GUICtrlListView_GetItemCount($idListview)
                If $iListView = 0 Then ContinueLoop
                For $i = 0 To $iListView
                    SplashTextOn("Computers", _GUICtrlListView_GetItemText($idListview, $i), 250, 50)
                    Sleep(1000)
                Next
                SplashOff()
        EndSwitch
    WEnd
EndFunc

 

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