Sign in to follow this  
Followers 0
Guest dfoster

Running scripts on conditions

3 posts in this topic

Hello,

I'm still rather new to AutoIT and I thought I'd post my question before delving into the help file too much to see if there was a really simple answer.

I'm in a Windows Server 2003 enviroment with a domain. The orgnization I'm working for right now has 32 client computers. Every month there's usually an update or a new program to install that requires me to script or manually install something to everyone of the 32 client machines. It gets to be a hassle, so I generally love macro programs and installer scripts.

I'd like to know if there is a simple way to add a condition to an autoit script. For instance: Say you need to install a new updated version of microsoft antispyware, you script the autoit script and it installs it just fine; however, you're calling on the script to run in the login.bat of the domain so everyday when the users logon they are going to be running the script. The subsequent runs of the script click through an unfamiliar gui and eventally ends mid way through a reinstall of the software leaving the installer gui on the user's screen. Also, some of the users have elected to install the update when MSAS bugged them enough to do it; so, even if it's a run once script some of the installs arn't going to go correctly. This isn't such a big issue as there's only 32 computers and it wouldn't take long to manually do it, however, I'd like to know just so things in the future go a little more smoothly.

So, how would you setup a condition not to run the script if a certain version or a certain window is called by the installer?

Also, is there any way to run autoIT unattended so the users cannot see what's going on?

I appreciate any comments, replies, and understand if you just tell me to go look in the help document at the if then else statements. I'm just checking to make sure there's no easy way to do this without having to go into all of that.

Thanks!

~Derrick Foster

System Integrations Inc.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

yes, you can have conditional statements in your autoit script, and the help file really is the place to learn the specifics of the language.

I'm just checking to make sure there's no easy way to do this without having to go into all of that.

in order to learn the language to write your scripts, you are going to HAVE TO make use of the help file. Not saying that as an RTFM or anything, there's just no way around the fact that you can't develop a solution to your problem without understanding the tool you're trying to use to do it. One thing i can suggest for you, as far as implementation for your situation. You can have an updater that is run by the login batch file, and your updater could check an ini for a network share and see if any updates are availible, installing only when there is something new to go on. That way you can have your 'unattended' update. Working with ini's is very easy with even just the functions that are already a part of AutoIT, and i think you'll be able to do exactly what you want pretty quickly with this language. Not sure if you've opened it at all yet, but the help file is pretty great, the way it's laid out is very intuitive and makes for quick pickup on the language.

Edited by cameronsdad

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

Some people I'm sure are very involved with this, but I, like you, am just getting into it when I'm caught up on other duties. I would say you need to anticipate the conditions, which is actually about impossible. I hand-installed AVG Antivirus on our forty pcs and ONE of them asked for a restart.

Specifically, to your question, you could check that a certain exe exists on the client pc, and check its filesize or other distinguishing characteristic to determine its version. As for the installer window, you will need to know the window text or title, or at least know all the "successful" titles you expect.

Note, you are not checking a condition to run the script, just to exit, or bypass certain code.

J


If I am too verbose, just say so. You don't need to run on and on.

Share this post


Link to post
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
Sign in to follow this  
Followers 0