Jump to content

Basic GUI List Box > Script Variable Input ||plzhelp


jtchurch
 Share

Recommended Posts

Hi There,

Only been using AutoIT for a week or so, but loving what I can do with it so far! -now frustratingly stumped and running out of time. :

I have a software upgrade to perform on about 200 network computers during a short planned downtime.

I have already created an AutoIT script that works beautifully to turn a complicated and time consuming software upgrade into a breeze.

The catch is that for the script to work, I have to be logged in to the remote PC (past the Windows login).

This of course severely limits my ability to automate the whole install project by running the script against a list of PCs.

I have tried to simplify the process by running a batch file against the list of PCs and copying all of the 700mb+ of upgrade install files over to each PC -so at least that's done.

My organization uses Dameware to provide remote support, and Dameware has a nice feature that allows command line connections complete with login info.

You cant seem to use AutoIT to interact directly (using ControlClick) with a remote desktop, the most that can be done is set the Dameware remote window as active with AutoIT and throw some unilateral commands at it with a lot of SLEEP delays and hope for the best. This I have also already done, creating a simple script that will open DameWare and connect to the network pc name in the AutoIT script, log in to the remote PC load the Windows desktop and open the command prompt by sending the windows key + R and CMD. THen navigating in the command prompt window to the compiled AutoIT script and starting it. The whole process works beautifully...once.

That is to say, I am still limited in that I will have to go in to the "connection" AutoIT script on my end and change the pc name in the script to kick things off, over and over again, almost 200 times.

It seems like it would be a simple thing to create a GUI with the list of pc names, where I could click PCNAME01 and GOBUTTON, whereby it will commence the 'connection' script I have already created, to connect to PCNAME01. Things look good, so then I click on PCNAME02 in the GUI list and click the GOBUTTON, the same script kicks off only connecting to PCNAME02 now, etc. 

I imagine this is can be accomplished by putting a variable in the 'connection' script in the place of an actual pc name, the variable getting its value from whichever list item is clicked in the GUI list box. Somehow, that is as far as my brain will take me. I've looked over the documentation for the GUI and downloaded the KODA FormDesginer, so I can generate the code for the GUI (more or less)... but to connect the GUI with my script... I'm lost.

Here is the connection script to use with Dameware -very simple

Run("C:\Program Files\DameWare Development\DameWare Mini Remote Control 7.5\DWRCC.exe -c: -m:pcname001 -u:username -p:password -d:domainname")
Sleep(5000)
ControlClick("DameWare Mini Remote Control", "OK", "[ID:2]")
sleep(2000)
Send("username{TAB}")
Send("password{ENTER}")
Sleep(10000)
WinActivate("pcname001 - Connected - DameWare Mini Remote")
Send("{LWIN}+R")
Sleep(3000)
Send("CMD{ENTER}")
Sleep(5000)
Send("c:\autoit-script-on-remote-pc.exe{ENTER}")

I don't expect free coding or anything, but is there an article or example I could look at that lays out this simple function in a way my simple mind can comprehend it? Thanks for your time folks!

J.

Link to comment
Share on other sites

Do a google search for psexec, it will allow you to run a program on a remote computer. Also, instead of using Send, you might want to look into using ControlSend instead so that you don't need to be logged onto the computer to do what it is you need to do.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Thanks for the reply BrewMan. We use PSEXEC quite a bit in our department, especially when running a process on a list and I tried it for this first, but found that the software update install required too much interaction to do without being logged in.

Link to comment
Share on other sites

What's the software, and is there a silent install switch?

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

So basically something like this:

VARIABLES          SCRIPTS         (GO BUTTON)

VariableA              Script1

VariableB              Script2

VariableC

VariableD

VariableE

VariebleF

VariableG

I could click on a selection in the VARIABLES column, choose a script from the SCRIPTS column and hit GO.

'GO' would execute the script I chose and somehow inserted the variable I chose from the VARIABLES column as input into the script.

(In my case, the variables in that column would be network pc names, used instead of the actual pc name directly written in to the scripts I have now).

Is this an easy setup with AutoIT?

Link to comment
Share on other sites

  • Moderators

jtchurch,

What you want to do sounds eninently possible. I imagine one reason that no-one has actually replied is because you appear to have made no effort to produce anything yourself and are sitting there waiting for someone to produce a working script for you. ;)

So I suggest you start coding and come up with something as a starter for 10. A couple of combos would enable you to choose the "variable" and "script" - then pressing the "Go button" would read those selections and run the "script", passing the "variable" as a command line parameter. Alternatively you can keep waiting - your choice. :)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

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