Sign in to follow this  
Followers 0
vojnet

First script

6 posts in this topic

I work for a big company and I was told to find a scripting tool to do some automated updates. I don't have much experience with scripting, but I like Open Source software, so I searched and found AutoIt. The task was to do multiple updates on an application GUI which otherwise take a lot of manual work. Basically, the script needs to go through fields, delete old text and type new one and save it. I created a demo, but I can't show it here as it is now the property of my company. This demo opens a ticket (this software is for Incident, Problem and Change management), enters all required information and saves it. I struggled a little bit, spent two days working on the script (there are more than a dozen of fields) - it was not easy. I had to use "WinWaitActive" a lot, as some of the clicks take a while. Also, I elected to enter the whole text, rather than just using the ellipsis button. The big issue is how to update the windows on the already running application. One needs to predict all scenarios, and to be able to invoke the right window that needs to be updated. The "WinActivate" does not always produce what I want - but these updates are not that frequent, so the user can even prepare the GUI a little bit, it is not a big deal. Just helping with the repetitive part is important.

The next step is to be able to use Excel (or .csv) to import the data. I have found these: - so I am going to try to use them.

So, it is a very good start, I was able to create a demo, now I will present it to the managers and move on to the real task.

It is fun working with AutoIt.

Share this post


Link to post
Share on other sites



Just curious which ticket management software you are using there?

Share this post


Link to post
Share on other sites

HP Service Manager

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

HP Service Manager

Sorry, I was warned by my boss that the code now belongs to my company (even though I told him it is a very simple code) and that I am not supposed to publish it anywhere. Anyway, I was able to make it work using WinWaitDealy. I am sure there is a more elegant solution, but this will do for now.

Edited by vojnet

Share this post


Link to post
Share on other sites

This tool, AUTOIT is great - my first script is already saving hours of work. Fantastic!

Share this post


Link to post
Share on other sites

This tool, AUTOIT is great - my first script is already saving hours of work. Fantastic!

This is one of the scripts, the rest are similar. The scenario is that there is a part of Service Manager which was customized for our company. The tricky part is that vendor does not support the customized part of the app, so it hasn't been maintained properly. Last time when we had this situation, my company had to pay for 'Win Runner' license plus for vendor's fee for development - a lot of money. So, I decided to go Open Source and try to do this - half the job is already done. The updates are going great! Now I am working on a little more complex script that would search for obsolete values and delete them.

Below code is vary basic, could be done much better, but it is doing its' job perfectly. WinWaitDelay is of much help, even though I could probably use another option for that.

I did have a problem making Service Manager respond to Control calls - it is simply dead, script does not run when using and Control related command. I will post some examples, maybe someone can tell me what I am doing wrong.

I will post my story on LinkedIN, as I am a member of Open Source group there, I will say nothing but the best about AutoIt.

; Prompt the user to run the script - use a Yes/No prompt
Global $i=0
$answer = MsgBox(4, "Service Manager QCD Update script", "This script will update QCD.  Run?")
; If "No" was clicked (7) then exit the script
If $answer = 7 Then
    MsgBox(0, "AutoIt", "OK.  Bye!")
    Exit
EndIf

Global $i=0

For $i = 1 to 10 Step 1
Opt("WinWaitDelay", 2000)
WinWait("[CLASS:SWT_Window0]", "", 105)
Opt("WinWaitDelay", 500)
Send("{TAB 3}{DOWN} {ENTER}")
WinWait("[CLASS:SWT_Window0]", "", 5)
Send("BlahBLah_1")
Send("{ENTER}")
WinWait("[CLASS:SWT_Window0]", "", 5)
Send("BlahBLah_2")
Send("{ENTER}")
WinWait("[CLASS:SWT_Window0]", "", 5)
Send("BlahBLah_3")
WinWait("[CLASS:SWT_Window0]", "", 5)
Send("{ENTER}")
WinWait("[CLASS:SWT_Window0]", "", 5)
Send("BlahBLah_4")
WinWait("[CLASS:SWT_Window0]", "", 5)
Send("{F10}")
WinWaitActive("Question")
WinWait("[CLASS:#32770]", "", 50)
Send("{Space}")
Next

Exit

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