[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

AutoIT

Posted on 2009-04-17
46
Medium Priority
?
1,193 Views
Last Modified: 2013-11-21
Please if someone can answer this one for me.
I created setup.au3 file and I compiled the setup.exe with it . Now when I click on it it creates many instances of setup on my task bar I am not sure why it keeps on creating so many instances. has any one seen that before.

Thanks,
0
Comment
Question by:Habib Z
  • 23
  • 23
46 Comments
 
LVL 4

Expert Comment

by:orbitus
ID: 24175463
You would need to post the code.
0
 

Author Comment

by:Habib Z
ID: 24175632
Hi Orbitus,
Here is the *.au3 script I recorded.
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
Run('C:\Documents and Settings\MyUsername\My Documents\AutoItProject\Setup.exe')
WinWait("NetScreen-Remote Setup","Welcome to the NetSc")
If Not WinActive("NetScreen-Remote Setup","Welcome to the NetSc") Then WinActivate("NetScreen-Remote Setup","Welcome to the NetSc")
WinWaitActive("NetScreen-Remote Setup","Welcome to the NetSc")
MouseMove(355,360)
MouseDown("left")
MouseUp("left")
WinWait("Confirm Uninstall","Do you want to compl")
If Not WinActive("Confirm Uninstall","Do you want to compl") Then WinActivate("Confirm Uninstall","Do you want to compl")
WinWaitActive("Confirm Uninstall","Do you want to compl")
MouseMove(165,85)
MouseDown("left")
MouseMove(164,85)
MouseUp("left")
WinWait("Uninstall IPSec Security Policy","Would you like to de")
If Not WinActive("Uninstall IPSec Security Policy","Would you like to de") Then WinActivate("Uninstall IPSec Security Policy","Would you like to de")
WinWaitActive("Uninstall IPSec Security Policy","Would you like to de")
MouseMove(172,103)
MouseDown("left")
MouseMove(171,103)
MouseUp("left")
WinWait("NetScreen-Remote Setup","NetScreen-Remote Set")
If Not WinActive("NetScreen-Remote Setup","NetScreen-Remote Set") Then WinActivate("NetScreen-Remote Setup","NetScreen-Remote Set")
WinWaitActive("NetScreen-Remote Setup","NetScreen-Remote Set")
MouseMove(443,359)
MouseDown("left")
MouseMove(442,359)
MouseUp("left")

I also wanted to know does Autoit compiled setup.exe file works under SMS.
 
Thanks,  
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24175758
Where are you compiling this code to? What is this line of code pointing at?
Run('C:\Documents and Settings\MyUsername\My Documents\AutoItProject\Setup.exe')

Open in new window

0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 4

Expert Comment

by:orbitus
ID: 24175759
It looks like you may be self referencing which would explain your duplicates.
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24175762
If you can run x86 applications on SMS then you can run AutoIt.  Applications like Firefox, Excel, Powerpoint.
0
 

Author Comment

by:Habib Z
ID: 24175810
So I delete this line. This is just my project folder.
Thanks
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24175821
Depends, you have a call to wait for this screen "NetScreen-Remote Setup". What calls it?
0
 

Author Comment

by:Habib Z
ID: 24175848
There are two ways of call it. The program is installed already so I am trying to uninstall it the location of the setup file on the computers is located as shown on the screen shot.
Or I can  use the orginal install file from the vendor and put it the C:drive in call of sms I will copy the whole package to the share folder.
 

Screenshot.jpg
0
 

Author Comment

by:Habib Z
ID: 24175867
Although this is a install shield application and I created a uninstall response file but the issue is the PC is rebooting after the uninstall is done which is terrible. Even though I made the bootOption = 0 ..  
Thats the reason now I am trying autoit.
Here is the code of the response file.
The command line I used is setup.exe /s /f1"C:\temp\answerfile.iss"
[InstallShield Silent]
Version=v6.00.000
File=Response File
[File Transfer]
OverwrittenReadOnly=NoToAll
[{2F931B84-0CEE-11D1-AA7D-0080AD1AC47A}-DlgOrder]
Dlg0={2F931B84-0CEE-11D1-AA7D-0080AD1AC47A}-SdWelcomeMaint-0
Count=4
Dlg1={2F931B84-0CEE-11D1-AA7D-0080AD1AC47A}-SprintfBox-0
Dlg2={2F931B84-0CEE-11D1-AA7D-0080AD1AC47A}-AskYesNo-0
Dlg3={2F931B84-0CEE-11D1-AA7D-0080AD1AC47A}-SdFinishReboot-0
[{2F931B84-0CEE-11D1-AA7D-0080AD1AC47A}-SdWelcomeMaint-0]
Result=303
[{2F931B84-0CEE-11D1-AA7D-0080AD1AC47A}-SprintfBox-0]
Result=1
[Application]
Name=NetScreen-Remote
Version=10.3.5.6
Company=Juniper
Lang=0009
[{2F931B84-0CEE-11D1-AA7D-0080AD1AC47A}-SdFinishReboot-0]
Result=1
BootOption=0
 
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24175895
What I mean is there is nothing in your autoIt code to activate that window. If you initiate the code, it is currently written to wait for the window to be there.  You would either need to activate the application that has the first window your looking for before you run your autoit script or code the script to kick off the application, then have it wait for the window.

If you list the full path of the script and the application that has the window "NetScreen-Remote Setup" I can help you write your script to kick it off.
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24175905
Also you may want to consider modifying your code to interact directly with the buttons and other controls on the application you want it to work with instead of moving the mouse.  Its much more reliable, I can help you with that as well if you like.
0
 

Author Comment

by:Habib Z
ID: 24177318
Yes Please that will helpful also Its my first time using AutoIT and any help is highly appreciated.
Well the path of the application will be in the network share that SMS will use as a source folder.
Lets say \\novfileserve\apps\Netscreen-remote\  --> this is where the setup file will be location. The script is also going to be located here.
Also I want to know what will be the command line to run on the SMS.
Thank you
 
0
 

Author Comment

by:Habib Z
ID: 24177325
Please let me know if you need more information from me.
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24177337
So, first replace
Run('C:\Documents and Settings\ZakariaH\My Documents\AutoItProject\Setup.exe') with the code below

When you compile your script you should probably make it more descriptive than setup.exe like perhaps "Netscreen Setup Script.exe"

Run('\\novfileserve\apps\Netscreen-remote\Setup.exe')

Open in new window

0
 

Author Comment

by:Habib Z
ID: 24177352
ok another question i have this could be stupid when compiling is it necessage to have the script name setup.au3 same as setup.exe. I have now problem doing that and then I can rename the setup.exe. Does it work that way.
Also how can I make it silent ?
0
 

Author Comment

by:Habib Z
ID: 24177356
Sorry another question I have is that as you know this package is going to be replicated to all the SMS distribution points. Will the program work still on other site?
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24177362
AutoIt comes with a fantastic tool called the AutoIt Window Information tool. It should be in the start menu under AutoIt.

Start that up when you are running the setup application you want it to interact with.  Autoit Needs three things to interact with a button or other control.  The window title (text on the form can be used to narrow the window selection too), the control name, and the control instance.

See this screencast for an example of this...

http://www.screencast-o-matic.com/watch/cQfFbueaa

Then replace the "Button2" in my code with the correct control ID and instance.

"Button" is the control ID
"2" is the instance
"Button2"

Hope this helps

Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
Run('\\novfileserve\apps\Netscreen-remote\Setup.exe')
WinWait("NetScreen-Remote Setup","Welcome to the NetSc")
If Not WinActive("NetScreen-Remote Setup","Welcome to the NetSc") Then WinActivate("NetScreen-Remote Setup","Welcome to the NetSc")
WinWaitActive("NetScreen-Remote Setup","Welcome to the NetSc")
ControlClick("NetScreen-Remote Setup","Welcome to the NetSc", "Button2") ; Check the tool for the real name
WinWait("Confirm Uninstall","Do you want to compl")
If Not WinActive("Confirm Uninstall","Do you want to compl") Then WinActivate("Confirm Uninstall","Do you want to compl")
WinWaitActive("Confirm Uninstall","Do you want to compl")
ControlClick("Confirm Uninstall","Do you want to compl", "Button2") ; Check the tool for the real name
WinWait("Uninstall IPSec Security Policy","Would you like to de")
If Not WinActive("Uninstall IPSec Security Policy","Would you like to de") Then WinActivate("Uninstall IPSec Security Policy","Would you like to de")
WinWaitActive("Uninstall IPSec Security Policy","Would you like to de")
ControlClick("Uninstall IPSec Security Policy","Would you like to de", "Button2") ; Check the tool for the real name
WinWait("NetScreen-Remote Setup","NetScreen-Remote Set")
If Not WinActive("NetScreen-Remote Setup","NetScreen-Remote Set") Then WinActivate("NetScreen-Remote Setup","NetScreen-Remote Set")
WinWaitActive("NetScreen-Remote Setup","NetScreen-Remote Set")
ControlClick("NetScreen-Remote Setup","NetScreen-Remote Set", "Button2") ; Check the tool for the real name

Open in new window

0
 
LVL 4

Accepted Solution

by:
orbitus earned 2000 total points
ID: 24177366
You can compile it as any name you want. I cant answer the specific SMS distribution question, im afraid you will have to trial and error that one.
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24177369
define silent?
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24177376
You can hide the tray icon by putting this near the top of your code. One more thing, most program's help files are fairly crappy. The AutoIt help files within the Scite editor are FANTASTIC.  Just go to the index tab and start typing.  you can see more information about controlclick and many, many others. I have been using AutoIt for years and I spend a LOT of time in the help files, they are just that usefull.
Opt("TrayIconHide", 1) 

Open in new window

0
 

Author Comment

by:Habib Z
ID: 24177399
I will respond to you in an hour time. Durring this time I will do the testing on your script as well as on the new tool. Looks very interesting as long as it works using SMS and the computers do not restart .
Thank you.
0
 

Author Comment

by:Habib Z
ID: 24177414
Silent means no user interaction or windows showing on the users screen while the program gets uninstalled during the advertisement through GPO or sms.
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24177425
lol, I suppose I was a little vague, i just wanted to know what level of silent you wanted.

You can try adding the below code to see if it will hide the window. Doesn't always work, depends if the window will play nice.

Insert it just before the control click on line 9 in the above code section.
WinSetState("NetScreen-Remote Setup","Welcome to the NetSc", @SW_HIDE)

Open in new window

0
 

Author Comment

by:Habib Z
ID: 24177445
ok will do.
0
 

Author Comment

by:Habib Z
ID: 24177450
how did you make your script did you use the AutoIT window Info tool
0
 

Author Comment

by:Habib Z
ID: 24177496
When using the AutoIt Window Info Tool where does it record the script or how can you see it .
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24177501
I used the window info tool, but had to use good old hand-to-keyboard to write the script.  That is how most AutoIt developers do it. The recording tools are very limited.
0
 

Author Comment

by:Habib Z
ID: 24177640
Another question I have can AutoIT scripts be changed to other known Scripts. if Possible ? Like vbs or batch files.
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24177646
The psuedocode (the structure of the process) could be used to make them in those languages if you knew both languages but there is no conversion tool or anything like that. I have often used vbs code in my AutoIt applications.
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24177647
after I convert it to Autoit formatting, of course.
0
 

Author Comment

by:Habib Z
ID: 24177726
Hi Orbitus,
I used the tool and I ran the script through the script editor --> tools --> go. I am now using my laptop to the run location is the C drive as you can see.
When I am compiling the au3 script do I need to specify any thing or just compile it using the options 1) Use UPX
 

Opt("TrayIconHide", 1) 
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
Run('C:\V8_5\Setup\Setup.exe')
WinWait("NetScreen-Remote Setup","Welcome to the NetSc")
If Not WinActive("NetScreen-Remote Setup","Welcome to the NetSc") Then WinActivate("NetScreen-Remote Setup","Welcome to the NetSc")
WinWaitActive("NetScreen-Remote Setup","Welcome to the NetSc")
WinSetState("NetScreen-Remote Setup","Welcome to the NetSc", @SW_HIDE)
ControlClick("NetScreen-Remote Setup","Welcome to the NetSc", "Button5") 
WinWait("Confirm Uninstall","Do you want to compl")
If Not WinActive("Confirm Uninstall","Do you want to compl") Then WinActivate("Confirm Uninstall","Do you want to compl")
WinWaitActive("Confirm Uninstall","Do you want to compl")
ControlClick("Confirm Uninstall","Do you want to compl", "Button1") 
WinWait("Uninstall IPSec Security Policy","Would you like to de")
If Not WinActive("Uninstall IPSec Security Policy","Would you like to de") Then WinActivate("Uninstall IPSec Security Policy","Would you like to de")
WinWaitActive("Uninstall IPSec Security Policy","Would you like to de")
ControlClick("Uninstall IPSec Security Policy","Would you like to de", "Button1") 
WinWait("NetScreen-Remote Setup","NetScreen-Remote Set")
If Not WinActive("NetScreen-Remote Setup","NetScreen-Remote Set") Then WinActivate("NetScreen-Remote Setup","NetScreen-Remote Set")
WinWaitActive("NetScreen-Remote Setup","NetScreen-Remote Set")
ControlClick("NetScreen-Remote Setup","NetScreen-Remote Set", "Button1") 

Open in new window

0
 
LVL 4

Expert Comment

by:orbitus
ID: 24177730
That should be fine.
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24177735
Was it able to hide the window ok?
0
 

Author Comment

by:Habib Z
ID: 24177775
When I run the script through the compiler it works fine and the program does gets uninstalled with no issues. But when I compiled it to the setup.exe I clicked on it I immediately get many processes of setup.exe opening up on the notification area. Any ideas why it does that I am thinking this could be compiling issue.
Is there a command line that I can use with it other then compiling it..
0
 

Author Comment

by:Habib Z
ID: 24178221
If I send you the installation files will you be able to compile it and test it. I am sorry I am asking too much but the 2 many processes of setup.exe keeps on opening up.
Thanks,
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24179298
It looks as though you are running that old version instead of the new one.  Here is a screen-cast of how to compile an application. Just be sure of your file name and be sure that is the one you are running.  As I said before, you should compile your project to not have the name setup.exe escpecially since you are trying to call setup.exe (the un-installer). Also by giving it a new name you can be sure that you are running the correct version of your script.

http://www.screencast-o-matic.com/watch/cQfqjleaM
0
 

Author Comment

by:Habib Z
ID: 24179346
ok I will try it in 30 min and let you know.
0
 

Author Comment

by:Habib Z
ID: 24179714
Now the uninstall.exe that I compiled is working. The last screen does not get any input please see the snapshot. I think the script does not have any information on this screen. can you assist in add this line as well .
Also when I run the uninstall.exe I can see the uninstallation happening on my screen how can I hide the screens and make it seemless to the end users.
I really appreciate your help.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_outfile=uninstalltest.exe
#AutoIt3Wrapper_Compression=0
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
Opt("TrayIconHide", 1) 
Opt("WinWaitDelay",100)
Opt("WinTitleMatchMode",4)
Opt("WinDetectHiddenText",1)
Opt("MouseCoordMode",0)
Run('C:\V8_5\Setup\Setup.exe')
WinWait("NetScreen-Remote Setup","Welcome to the NetSc")
If Not WinActive("NetScreen-Remote Setup","Welcome to the NetSc") Then WinActivate("NetScreen-Remote Setup","Welcome to the NetSc")
WinWaitActive("NetScreen-Remote Setup","Welcome to the NetSc")
WinSetState("NetScreen-Remote Setup","Welcome to the NetSc", @SW_HIDE)
ControlClick("NetScreen-Remote Setup","Welcome to the NetSc", "Button5") 
WinWait("Confirm Uninstall","Do you want to compl")
If Not WinActive("Confirm Uninstall","Do you want to compl") Then WinActivate("Confirm Uninstall","Do you want to compl")
WinWaitActive("Confirm Uninstall","Do you want to compl")
ControlClick("Confirm Uninstall","Do you want to compl", "Button1") 
WinWait("Uninstall IPSec Security Policy","Would you like to de")
If Not WinActive("Uninstall IPSec Security Policy","Would you like to de") Then WinActivate("Uninstall IPSec Security Policy","Would you like to de")
WinWaitActive("Uninstall IPSec Security Policy","Would you like to de")
ControlClick("Uninstall IPSec Security Policy","Would you like to de", "Button1") 
WinWait("NetScreen-Remote Setup","NetScreen-Remote Set")
If Not WinActive("NetScreen-Remote Setup","NetScreen-Remote Set") Then WinActivate("NetScreen-Remote Setup","NetScreen-Remote Set")
WinWaitActive("NetScreen-Remote Setup","NetScreen-Remote Set")
ControlClick("NetScreen-Remote Setup","NetScreen-Remote Set", "Button1") 

Open in new window

Lastscreen.jpg
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24179728
If the last line of the script is the window on that last page in your picture and the window info tool was over that button then it looks like the script is referencing Button1 but the name of the button on the window is Button4
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24179733
As for hiding the window, that might not be possible all you can do is put the hide command after each new window pops up, assuming the first one was successful.
WinSetState("NetScreen-Remote Setup","Welcome to the NetSc", @SW_HIDE

Open in new window

0
 

Author Comment

by:Habib Z
ID: 24179737
I think the screen before that was button1. This is another screen that shows up again in the end. I think thats whats happening. I can change it and check it.
 
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24179754
Another thing you can try to do is put the hide in the run command itself like below.
Run('C:\V8_5\Setup\Setup.exe','',@SW_HIDE)

Open in new window

0
 

Author Comment

by:Habib Z
ID: 24179815
Ok so I changed the button1 to button4 and the screen previous to the one posted does not get any response do I think I am missing on additional time on the script.
 
0
 

Author Comment

by:Habib Z
ID: 24179868
the hide did not work I am not sure how sms deployment will work.
0
 
LVL 4

Expert Comment

by:orbitus
ID: 24180003
Im sorry it didnt work. AutoIt is still great for a lot of things. Hope you can find it useful for something else one day.
0
 

Author Comment

by:Habib Z
ID: 24180408
Hi Orbitus,
I learned it well with you being on top of my questions I appreciate the help and the support. You are the best so far.
Now that I know AutoIT I will for sure use it in other works.
I will ask the customer service to delete the first snapshot I posted as it does have my username just for your info
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Know what services you can and cannot, should and should not combine on your server.
Learn the basics of lists in Python. Lists, as their name suggests, are a means for ordering and storing values. : Lists are declared using brackets; for example: t = [1, 2, 3]: Lists may contain a mix of data types; for example: t = ['string', 1, T…
Learn the basics of while and for loops in Python.  while loops are used for testing while, or until, a condition is met: The structure of a while loop is as follows:     while <condition>:         do something         repeate: The break statement m…
Suggested Courses
Course of the Month18 days, 6 hours left to enroll

830 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question