Jump to content

catching downloads in an IE object


Recommended Posts

A while back, I wrote a script which went to ninite.com, selected the checkboxes for the applications needed for os deployment, and submitted the form.  Back then, to start the download, I simply had script lock user input, sleep for 5 seconds to wait for download prompt to appear, used Send to press tab and enter on "run" for download prompt, then unlock user input.  However, I am working on another project now which requires a bit more...assurance.  Basically, the problems with the method on the last problem had many issues: 1) since it was for os deployments, usually when the script was run, the Internet explorer first run windows kept getting in the way, requiring me to create a completely arbitrary function to call before the main function which would open IE, wait, then force end it to get rid of prompt, 2) I lock the user input since the success of the process is dependent on where the caret position is in the IE window, and users just love to mess with stuff.  But this creates the draw back that, heaven forbid, something in the background of the users computer could cause IE to lose focus in one way or another, which results in the download failing and script is not successful.  So, on to main question.  For those who have used ninite, you know already that the executable is not at a set URL, it is generated depending on the checkboxes the user selects for the applications they want installed, so I can't just use Inetget.  Is there a way that I can "hook" or get a handle to the object which facilitates downloads in IE?  Thanks in advance.

Link to comment
Share on other sites

Hi MattHiggs,

I do not know if I got right your intent (not a native english), but you can monitor the "BeforeNavigate" event then read urls (take any action if you want to) and use the "DownloadBegin" and "DownloadComplete" events to make a proper check. There is an exemple in the helpfile under the "ObjEvent" function that shows how to use the "BeforeNavigate2" event.

Link to comment
Share on other sites

Ok.  So from what I understand, you seem to think I am referring to a simple Inet function call.  My issue is a little more complicated than that,  I would suggest, just so you know what I am talking about, to check out www.ninite.com.  you select check boxes for applications you want to pack into a single "exe" file, then submit the form.  The next page (wherein lies my issue), starts the download for the GENERATED exe using the inputs from previous page.  Since the URL is not a constant, rather than InetGet, I was wondering if there was a way to simply automate the download manager built into IE to simply save or download the file as it is run through the IE download manager?

Edited by MattHiggs
Link to comment
Share on other sites

As i can see the urls are build like this:

https://ninite.com/7zip-peazip-winrar/ninite.exe [3 applications]

https://ninite.com/7zip-evernote-googleearth-peazip-winrar/ninite.exe [5 applications]

Did you try to build them (urls) and download with the native autoit functions?

Your issue is not that complicated, as i told you in #2 you can listen to the browser events and take proper action, the download "popup" can also be automated (you can grab the control info in the autoit window info).

Link to comment
Share on other sites

Hm.  This is something foreign to me.  As for the popup window being controlled using windows control functions, that won't work because IE 11, since the buttons are not listed as actual controls (see pic) to click.  Furthermore, the whole point of just catching or automating downloads from the built in download manager is the only real solution I will accept for one reason: the fact that the excutable is built using a URL schema means that the owner of the service could, at any point in time, change a single aspect of the URL generation schema, and it would essentially bring operating system deployments to a grinding halt until I go, find what has changed (could be as simple as one program in url list appeared farther down the list), rewrite the script with management breathing down my neck like the vultures they are, and then incorporate it back into deployment process.  This is about scalability and reducing number of points of failure.  Using the actual download manager to catch the download reduces the work I have to do all around (the whole point of automation), which is why building the URLs within the scripts may but it at first, but not for long run.   However, I feel we are getting a bit off topic, as I have said, this is just an example that is similar to the project working on now.  This project is already done and implemented (due to time restraints).  For a better idea as to what I am looking for, look here.  However, "listening for browser events" is not something I have ever tried before.  Could you elaborate more on that?  Would you be able to provide an example of what this would look like?  Maybe incorporate it into aforementioned project for simplicity?:

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_SaveSource=y
#AutoIt3Wrapper_Res_Language=1033
#AutoIt3Wrapper_Res_requestedExecutionLevel=requireAdministrator
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#cs ----------------------------------------------------------------------------
 AutoIt Version: 3.3.15.0 (Beta)
 Author:         myName
 Script Function:
    Template AutoIt script.
#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here

#include <IE.au3>
#include <Constants.au3>

Local $oIE = _IECreate("www.ninite.com")
If Not IsObj($oIE) Then Exit ConsoleWrite("Error in $oIE" & @CRLF)

Sleep(5000) ; just to make sure

Local $oTeamViewer11 = _IEGetObjById($oIE, "cb_bd6x4")
If Not IsObj($oTeamViewer11) Then Exit ConsoleWrite("Error in $oTeamViewer11" & @CRLF)

Local $o7Zip = _IEGetObjById($oIE, "cb_bcaaf")
If Not IsObj($o7Zip) Then Exit ConsoleWrite("Error in $o7Zip" & @CRLF)

Local $oChrome = _IEGetObjById($oIE, "cb_kvedr")
If Not IsObj($oChrome) Then Exit ConsoleWrite("Error in $oChrome" & @CRLF)

Local $oOpera = _IEGetObjById($oIE, "cb_dqbak")
If Not IsObj($oOpera) Then Exit ConsoleWrite("Error in $oOpera" & @CRLF)

Local $oFirefox = _IEGetObjById($oIE, "cb_22s4s")
If Not IsObj($oFirefox) Then Exit ConsoleWrite("Error in $oFirefox" & @CRLF)

Local $oVLC = _IEGetObjById($oIE, "cb_5hco5")
If Not IsObj($oVLC) Then Exit ConsoleWrite("Error in $oVLC" & @CRLF)

Local $oKlite = _IEGetObjById($oIE, "cb_w53be")
If Not IsObj($oKlite) Then Exit ConsoleWrite("Error in $oKlite" & @CRLF)

Local $oSpotify = _IEGetObjById($oIE, "cb_tlvlq")
If Not IsObj($oSpotify) Then Exit ConsoleWrite("Error in $oSpotify" & @CRLF)

Local $oCCCP = _IEGetObjById($oIE, "cb_xsupa")
If Not IsObj($oCCCP) Then Exit ConsoleWrite("Error in $oCCCP" & @CRLF)

Local $ojava = _IEGetObjById($oIE, "cb_za42k")
If Not IsObj($ojava) Then Exit ConsoleWrite("Error in $ojava" & @CRLF)

Local $oNet = _IEGetObjById($oIE, "cb_4e5lw")
If Not IsObj($oNet) Then Exit ConsoleWrite("Error in $oNet" & @CRLF)

Local $oSilver = _IEGetObjById($oIE, "cb_sutoa")
If Not IsObj($oSilver) Then Exit ConsoleWrite("Error in $oSilver" & @CRLF)

Local $oAir = _IEGetObjById($oIE, "cb_hrcyq")
If Not IsObj($oAir) Then Exit ConsoleWrite("Error in $oAir" & @CRLF)

Local $oShock = _IEGetObjById($oIE, "cb_rci2j")
If Not IsObj($oShock) Then Exit ConsoleWrite("Error in $oShock" & @CRLF)

Local $oIrfan = _IEGetObjById($oIE, "cb_2n6do")
If Not IsObj($oIrfan) Then Exit ConsoleWrite("Error in $oIrfan" & @CRLF)

Local $oXn = _IEGetObjById($oIE, "cb_hzubg")
If Not IsObj($oXn) Then Exit ConsoleWrite("Error in $oXn" & @CRLF)

Local $oGreen = _IEGetObjById($oIE, "cb_wq43l")
If Not IsObj($oGreen) Then Exit ConsoleWrite("Error in $oGreen" & @CRLF)

Local $oShare = _IEGetObjById($oIE, "cb_nfdvi")
If Not IsObj($oShare) Then Exit ConsoleWrite("Error in $oShare" & @CRLF)

Local $oFoxit = _IEGetObjById($oIE, "cb_n3l7s")


Local $oSuma = _IEGetObjById($oIE, "cb_m4qxn")


Local $oCute = _IEGetObjById($oIE, "cb_g2ba4")


Local $oMal = _IEGetObjById($oIE, "cb_mgdaa")


Local $oSpy = _IEGetObjById($oIE, "cb_fflxm")



Local $oDrop = _IEGetObjById($oIE, "cb_f4z4i")


Local $oDrive = _IEGetObjById($oIE, "cb_v4sqq")



Local $oBit = _IEGetObjById($oIE, "cb_mwfrt")



Local $oEver = _IEGetObjById($oIE, "cb_i2ycj")



Local $oKey = _IEGetObjById($oIE, "cb_jrd6u")



Local $oEvery = _IEGetObjById($oIE, "cb_gew3n")


Local $oRevo = _IEGetObjById($oIE, "cb_lpcec")


Local $oGlary = _IEGetObjById($oIE, "cb_h4enj")


Local $oRar = _IEGetObjById($oIE, "cb_nxciq")

Local $oPython = _IEGetObjById($oIE, "cb_epxow")


Local $oFile = _IEGetObjById($oIE, "cb_xqkaw")

Local $oNote = _IEGetObjById($oIE, "cb_j2gws")

Local $oJdk = _IEGetObjById($oIE, "cb_azvh4")

Local $oWinScp = _IEGetObjById($oIE, "cb_3nmgs")

Local $oPutty = _IEGetObjById($oIE, "cb_uriix")

Local $oWinMerge = _IEGetObjById($oIE, "cb_a7h2w")

Local $oEclipse = _IEGetObjById($oIE, "cb_nn5wk")

$oForm = _IEFormGetCollection ( $oIE, 0 )

$oTeamViewer11.checked = True
$o7Zip.checked = True
$oChrome.checked = True
$oOpera.checked = True
$oFirefox.checked = True
$oVLC.checked = True
$oKlite.checked = True
$oSpotify.checked = True
$oCCCP.checked = True
$ojava.checked = True
$oNet.checked = True
$oSilver.checked = True
$oAir.checked = True
$oShock.checked = True
$oIrfan.checked = True
$oXn.checked = True
$oGreen.checked = True
$oShare.checked = True
$oFoxit.checked = True
$oSuma.checked = True
$oCute.checked = True
$oMal.checked = True
$oSpy.checked = True
$oDrop.checked = True
$oDrive.checked = True
$oBit.checked = True
$oEver.checked = True
$oKey.checked = True
$oEvery.checked = True
$oRevo.checked = True
$oGlary.checked = True
$oRar.checked = True
$oPython.checked = True
$oFile.checked = True
$oNote.checked = True
$oJdk.checked = True
$oWinScp.checked = True
$oPutty.checked = True
$oWinMerge.checked = True
$oEclipse.checked = True

Sleep ( 3000 )
BlockInput ( 1 )  ;get rid of this part when window activation and caret location no longer a factor


_IEFormSubmit ( $oForm )

;this is where the next page will load and the download will begin
Sleep ( 5000 )
Send ( "{TAB 2}" & "{ENTER}", 0 )
BlockInput ( 0 )
Sleep ( 5000 )
RunWait ( @ComSpec & ' /c powershell -command "Get-ChildItem -Path $env:USERPROFILE\Downloads\* -Recurse | Unblock-file"' )
$down = @UserProfileDir & "\downloads"
FileChangeDir ( $down )
$search = FileFindFirstFile ( "Ninite*.exe" )
$files = FileFindNextFile($search)
ShellExecute ( $files, "", $down )
$nin = WinWait ( "Ninite", "Close" )
WinActivate ( $nin )
WinWaitActive ( $nin )
ControlClick ( $nin, "", 2 )

 

2016-07-21 17_37_45-Greenshot.png

Edited by MattHiggs
Link to comment
Share on other sites

Do you know any settings in IE which will avoid this POP UP "Do you want to run or save ......."
I just want a situation when files will be automatically saved.

I was thinking about File Download Restrictions:
https://msdn.microsoft.com/en-us/library/ee330731(v=vs.85).aspx#file_downloads

But I never test it.

 

EDIT:
https://msdn.microsoft.com/en-us/library/ms537169(v=vs.85).aspx

Quote

FEATURE_RESTRICT_FILEDOWNLOAD
Block file downloads that navigate to a resource, that display a file download dialog box, or that are not initiated explicitly by a user action (for example, a mouse click or key press). This feature, when enabled, can be set differently for each security zone by using the URL action flag URLACTION_AUTOMATIC_DOWNLOAD_UI.

 

https://msdn.microsoft.com/en-us/library/ms537178(v=vs.85).aspx

URLACTION_AUTOMATIC_ACTIVEX_UI
0x00002201

Internet Explorer 6 for Windows XP SP2 and later. Determines whether to display the Information Bar for ActiveX control installations rather than the ActiveX control prompt. Requires that the feature control FEATURE_RESTRICT_ACTIVEXINSTALL for c

Edited by mLipok

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

Spoiler

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

My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST APIErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 *

 

My contribution to others projects or UDF based on  others projects: * _sql.au3 UDF  * POP3.au3 UDF *  RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane

Useful links: * Forum Rules * Forum etiquette *  Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * 

Wiki: Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * 

OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX

IE Related:  * How to use IE.au3  UDF with  AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskSchedulerIE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related:How to get reference to PDF object embeded in IE * IE on Windows 11

I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions *  EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *

I also encourage you to check awesome @trancexx code:  * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuffOnHungApp handlerAvoid "AutoIt Error" message box in unknown errors  * HTML editor

winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/

"Homo sum; humani nil a me alienum puto" - Publius Terentius Afer
"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming"
:naughty:  :ranting:, be  :) and       \\//_.

Anticipating Errors :  "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty."

Signature last update: 2023-04-24

Link to comment
Share on other sites

@MattHiggs, try this example:

#include <InetConstants.au3>
#include <IE.au3>

Global $bDownloadFinished = False

ExampleStart()
Exit

Func ExampleStart()

    Local $oIE = _IECreate("www.ninite.com")

    Local $oIEEvents = ObjEvent($oIE, "_IEEvent_", "DWebBrowserEvents2")
    If Not IsObj($oIEEvents) Then Exit ConsoleWrite("Error in $oIEEvents" & @CRLF)

    $aInputElements = _IEquerySelectorAll($oIE, 'ul[class ="list-unstyled center-block js-masonry"] input, body > div > form', -1)
    If @error Or Not IsArray($aInputElements) Then Exit ConsoleWrite("Error in $aInputElements" & @CRLF)

    For $i = 1 To UBound($aInputElements)-1
        ConsoleWrite($aInputElements[$i].value & @CRLF)
        $aInputElements[$i].checked = True
    Next

    _IEFormSubmit($aInputElements[0])
    If @error Then Exit ConsoleWrite("Error in _IEFormSubmit. Error code: " & @error & @CRLF)

    While Not $bDownloadFinished
        Sleep(100)
    WEnd

    MsgBox(0,0,"Done!")

EndFunc   ;==>ExampleStart

Func _IEquerySelectorAll(ByRef $oObject, $sQuery, $iIndex = 0)
    If Not __IEIsObjType($oObject, "browserdom") Then
        __IEConsoleWriteError("Error", "_IEquerySelectorAll", "$_IESTATUS_InvalidObjectType", ObjName($oObject))
        Return SetError($_IESTATUS_InvalidObjectType, 0, 0)
    ElseIf Not IsInt($iIndex) Or Not ($iIndex > -2) Then
        __IEConsoleWriteError("Error", "_IEquerySelectorAll", "$_IEStatus_InvalidValue", "Invalid Index")
        Return SetError($_IEStatus_InvalidValue, 0, 0)
    EndIf

    Local $oCol = __IEIsObjType($oObject, "documentcontainer") ? $oObject.document.querySelectorAll($sQuery) : $oObject.querySelectorAll($sQuery)

    If @error Then
        __IEConsoleWriteError("Error", "_IEquerySelectorAll", "$_IESTATUS_COMError", @error)
        Return SetError($_IESTATUS_COMError, 0, 0)
    ElseIf Not IsObj($oCol) Then
        __IEConsoleWriteError("Error", "_IEquerySelectorAll", "$_IESTATUS_InvalidObjectType", "Invalid Object")
        Return SetError($_IESTATUS_InvalidObjectType, 0, 0)
    ElseIf $oCol = Null Or $oCol.length = 0 Then
        __IEConsoleWriteError("Error", "_IEquerySelectorAll", "$_IEStatus_NoMatch")
        Return SetError($_IEStatus_NoMatch, 0, 0)
    ElseIf $iIndex >= $oCol.length Then
        __IEConsoleWriteError("Error", "_IEquerySelectorAll", "$_IEStatus_InvalidValue", "$iIndex > Nº of elements found")
        Return SetError($_IEStatus_InvalidValue, 0, 0)
    EndIf

    If $iIndex = -1 Then
        Local $aColReturn[$oCol.length]
        For $i = 0 To $oCol.length - 1
            $aColReturn[$i] = $oCol.Item($i)
        Next
        Return SetError($_IEStatus_Success, $oCol.length, $aColReturn)
    Else
        Return SetError($_IEStatus_Success, $oCol.length, $oCol.Item($iIndex))
    EndIf
EndFunc   ;==>_IEquerySelectorAll

Func _IEEvent_BeforeNavigate2($oIEpDisp, $sIEURL, $iIEFlags, $sIETargetFrameName, $sIEPostData, $iIEHeaders, $bIECancel)
    ConsoleWrite(@CRLF & "!!!!--BeforeNavigate2 fired--!!! --> " & "$sIEURL = " & $sIEURL)
    If StringInStr($sIEURL, "ninite.exe") Then
        ConsoleWrite(@CRLF & @CRLF & "--> Download STARTED --> " & $sIEURL & @CRLF)

        Local $sFilePath = @TempDir & "\niniteTEST.exe"

        ; Download the file in the background with the selected option of 'force a reload from the remote site.'
        Local $hDownload = InetGet($sIEURL, $sFilePath, $INET_FORCERELOAD, $INET_DOWNLOADBACKGROUND)

        ; Wait for the download to complete by monitoring when the 2nd index value of InetGetInfo returns True.
        Do
            Sleep(250)
        Until InetGetInfo($hDownload, $INET_DOWNLOADCOMPLETE)

        ; Retrieve the number of total bytes received and the filesize.
        Local $iBytesSize = InetGetInfo($hDownload, $INET_DOWNLOADREAD)
        Local $iFileSize = FileGetSize($sFilePath)

        ; Close the handle returned by InetGet.
        InetClose($hDownload)

        ; Display details about the total number of bytes read and the filesize.
        ConsoleWrite("Donwload path: " & $sFilePath & @CRLF)
        ConsoleWrite("The total download size: " & $iBytesSize & " | The total filesize: " & $iFileSize & @CRLF)

        ConsoleWrite("--> Download FINISHED -->" & $sIEURL & @CRLF & @CRLF)
        $bDownloadFinished = True
    EndIf
EndFunc   ;==>_IEEvent_BeforeNavigate2

Exit

@mLipok, i dont know any options to disable the save dialog in IE 11. Some interesting references, thanks, i'll play with them later. :)

Edited by MichaelHB
Link to comment
Share on other sites

The lack of ability to automate the download in IE has been a frustration for me, and for others too I bet. Implementing a custom download manager is beyond my abilities. If you can get it to work, I'll be happy to know.

now for a more practical and efficient solution - how about you create the package once, and deploy it along with your script.

if your script always checks the same apps in the ninite package, then why bother redo it all again and again for every machine, waste time and bandwidth, tackle all the issues you mention.

this is also good for version control. When you get a ninite package for each machine, as you do now, you have no control of which version of which app is deployed on which machine. When you create the package once, you know exactly which version of which app you have. You need only recreate the package when newer versions of apps are available in ninite. No shorter interval than once a month, I dare say. If you also handle updates to ninite-deployed apps, this kind of version control is very useful.

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

@orbs, what kind of automation in IE download you are looking for (start/stop/resume)? Also, did you try my example in #9? If you really want to click and use the build in download manager in IE, you can easily use UI Automation to "open" / "save" / "saveas" / "cancel" etc, then you can open the download manager (ctrl+j) and get some limited information. Now if you are talking about COM access you can build your own IE Custom Download Manager, i found these example (never tested myself).

Link to comment
Share on other sites

8 hours ago, orbs said:

now for a more practical and efficient solution - how about you create the package once, and deploy it along with your script.

The purpose of using Ninite would be so that you get the latest version rather than one you might have downloaded a year ago.

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

7 hours ago, MichaelHB said:

what kind of automation in IE download you are looking for (start/stop/resume)? Also, did you try my example in #9?

what i was after is just to instruct IE to perform the download automatically. now i tried your code and i find it quite impressive! i was not aware of the ability to hook into events with a custom function like that, i must study that technique further for future implementation. it certainly beats UI automation in every way.

4 hours ago, BrewManNH said:

The purpose of using Ninite would be so that you get the latest version

my original suggestion was to recreate the package whenever a new version of any included app is available - which makes a decent update policy in my view, but mainly it is meant to allow skipping the IE part from performing on each machine altogether.

however, as i mentioned i tested the code in post #9, and found something quite odd. i was under the impression that the ninite.exe is a self-contained installer for all the selected apps; however it seems that ninite.exe is merely a catalog, which when launched, downloads the selected apps from the web for installation. is this indeed so?

when performed per every machine, i find this to be a terrible waste of time and bandwidth, as well as forcing web access as a pre-requirement for image build, which is not always the case. but the worst part is that there is actually no need to recreate the ninite.exe package at all! and makes the process performed per every machine even more pointless and wasteful than already is.

 

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

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