Jump to content

Automating AutoIt installation with AutoIt


mohitag19
 Share

Recommended Posts

Hi, I am trying to write a script which installs the AutoIT software and Scite Editor on the running machine. I am able to click the appropriate buttons on IE using object related functions, but I am having the following problems:

1. IE is popping up small dialog boxes on the bottom of screen sometimes such that "it might not be safe to download this editor. Do you want to continue?". The only way I have to pass this dialog box is to send Alt+r (to continue run), but how do I detect when it's popping up? It's neither an element nor can be identified as a separate window. 

2. UAC pops up a dialog box which can be "allowed" by sending Alt+y but again I can't find any way to detect it's occurrence. Also, I don't want to keep sending Alt+y because the downloading takes some time and UAC pop up takes some more time, so meanwhile if the user uses his mouse, the UAC pop would be originated as minimized. So, to send Alt+y, the user is supposed to click on it from the taskbar since I can't send a control click. 

3. Step 1 and 2 might depend on the windows version of the computer. As far as I know, UAC has a different interface in Windows 8. So, any way to tackle this?

Can you show me any related Example script, if exists?

Link to comment
Share on other sites

Can you explainwhat IE object and clicking on them has to do with installing autoit?

EDIT:

Are you trying to download AutoIt you mean?

I'd probably go for InetGet() function.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Thank you for replying John. 

Yes, I am trying to download AutoIT and Scite Editor before the installation. Actually, I want to show this familiar process to the user like opening up the appropriate link and then downloading. If it doesn't have a clean solution for all windows versions, I can move on to the one that you have given. Any more tips please?

Link to comment
Share on other sites

What might work on XP might not on later versions, for both IE and UAC prompts.

I don't think the bosses here like discussing closing security prompts, or for that matter, detecting them, which is what UAC is.

You could of course programmatically turn off UAC but that would require the script to be run under administrator rights.

If it is some sort of tutorial, you could show images or even animated gifs, while using InetGet to do the actual downloads.

If you carry on down the automating IE route, I suggest you post your code.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I am convinced to use InetGet now (thanks for that) but it will be my first time with this function. I'll post my script today using InetGet if I get stuck on somewhere.

Yes, it's for a tutorial. I want to convert this au3 to exe and give it to the students. It will make their download/installation of AutoIt and Scite easier and also might impress them with a simple use of AutoIt. That's possible right? I know memory wise my exe file will be heavier which is not really a requirement for the download but that's okay.

Link to comment
Share on other sites

I am done with my script. I am doing the silent installation, which doesn't initiate any UAC prompt as well! It's working perfectly. Will cover the demonstration by other means if need be.

Can you think of any important modifications required in this script? I have tested this script on three systems (all Windows 7), but I am afraid if it shows up any new error.

#include <InetConstants.au3>

Hotkeyset("{END}","kill")

Func Download($url, $filename)
    Local $hDownload = InetGet($url, $filename, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)
    Do
    Sleep(250)
    Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)
    InetClose($hDownload)
EndFunc

Func kill()
    Msgbox(0,"Exit","The Script is terminated",5)
    Exit 0
EndFunc

;Download Autoit
ToolTip("Downloading Autoit-Setup",0,0,"Pressing END terminates the script" )
Download("https://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3-setup.exe","autoit-v3-setup.exe")
Tooltip("Installing Autoit",0,0,"Pressing END terminates the script")
runwait("autoit-v3-setup.exe /S")


;Download Scite
Tooltip("Downloading Scite-Setup",0,0,"Pressing END terminates the script")
Download("https://www.autoitscript.com/cgi-bin/getfile.pl?../autoit3/scite/download/SciTE4AutoIt3.exe","Scite4Autoit3.exe")
Tooltip("Installing Scite",0,0,"Pressing END terminates the script")
runwait("Scite4Autoit3.exe /S")

;Deleting Setup files
FileDelete("autoit-v3-setup.exe")
FileDelete("Scite4Autoit3.exe")


run("C:\Program Files (x86)\AutoIt3\SciTE\SciTE.exe")
Msgbox(64,"Congratulations","Autoit has been installed on your computer successfully",5)
Link to comment
Share on other sites

Alas, I am having a trouble. In some systems, the download is not getting completed (it's downloading a partial file for Autoit-setup and moving on to Scite download). I can't think of a reason. Could you please help me out. 

2 Cases I can give you that has gone wrong:

1. If I try this combination : Download Autoit , Download Scite, Install Autoit, Install Scite. Then, Scite,exe gets corrupted. If I comment out Download Autoit and 2 installs, then it downloads Scite.exe perfectly!

2. If I try - Download Autoit, Install Autoit, Download Scite, Install Scite. Then, most of the times it works, but sometimes Autoit.exe gets corrupted. I have no explanation for this random behavior.

Can you think of anything?

Link to comment
Share on other sites

add two things right after your download func

1) checksum 

2) if it fails the checkum then redownload

Edited by boththose

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

@boththose : The checksum will look same even with the partial download. And even if it could work, redownload is not a solution, it shows the similar behavior only. If it is not downloading, it won't most probably download again. I tried 10 times on my computer, and all the times it downloaded a corrupted file. And the same script worked perfectly on my friend's computer. Earlier it was working on my system as well.

@jdelaney : I am converting it to exe and then giving to a set of people who doesn't have autoit installed on their systems already. So, I can't get rid of the download. The script needs to download the setups everytime it runs.

Link to comment
Share on other sites

did you look at what fileinstall does (click the 'funciton name link', above)?  The installer is compiled into your exe, copied out locally (at execution time), and then you can run it locally...long story short: yes you can.

Edited by jdelaney
IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.
Link to comment
Share on other sites

The checksum will look same even with the partial download

 

 

That would defeat the entire purpose of a checksum.

 When it downloads this corrupted file, is it remotely close to the same size as a proper version of the file?  

Do you get different behavior if you use $INET_DOWNLOADWAIT (0) instead of $INET_DOWNLOADBACKGROUND (1)?

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

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