找回密码
 加入
搜索
查看: 1767|回复: 2

[系统综合] 求助UI中嵌入IE页面里的下载,点击时能否直接使用AU3的下载。

[复制链接]
发表于 2015-7-6 18:52:22 | 显示全部楼层 |阅读模式
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <ie.au3>
$oIE = ObjCreate("Shell.Explorer.1")

#Region ### START Koda GUI section ### Form=
$GUIMain = GUICreate("GUIMain", 300, 200, 0, 0)
GUICtrlCreateObj($oIE, 0, -0, 200, 100)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

$EventObject=ObjEvent($oIE,"IEEvent_","DWebBrowserEvents")
$URL = "http://pzz.cn/a.html"
$oIE.Navigate( $URL ) 

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

        EndSwitch
WEnd

Func IEEvent_NewWindow($ppDisp,$Cancel)
        Local $o_Shell = ObjCreate("Shell.Application")
        Local $o_ShellWindows = $o_Shell.Windows(); collection of all ShellWindows (IE and File Explorer)
        For $i = $o_ShellWindows.Count-1 To 0 Step -1
                If $o_ShellWindows.item($i).LocationURL==$ppDisp Then
                        $o_ShellWindows.item($i).quit()
                EndIf
        Next
        $oIE.Navigate( $ppDisp )        
EndFunc 
当点击UI网页里的"下载安装文件到电脑"直接在UI中显示一个进度条直接进行下载,而不是弹出IE的对话框中的下载呢?
点击下载时,类似以下程序这样。
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ProgressConstants.au3>
#include <WindowsConstants.au3>
#include <IE.au3>
#Region ### START Koda GUI section ### Form=
$Form1 = GUICreate("测试", 623, 442, 192, 124)
$Progress1 = GUICtrlCreateProgress(72, 96, 393, 65)
$Button1 = GUICtrlCreateButton("", 104, 216, 305, 97)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
                Case $GUI_EVENT_CLOSE
                        Exit

                Case $Button1
                        $url = "http://pzz.cn/soft/g64.exe"
                        $get = InetGet($url, @ScriptDir & "\g64.exe", 1, 1)
                        $size = Int(InetGetSize($url) / 1024)
                        AdlibRegister("Down")
        EndSwitch
WEnd

Func Down()
        $newsize = InetGetInfo($get)
        $pro = Int($newsize[0] / 1024) / $size
        GUICtrlSetData($Progress1, $pro * 100)
        GUICtrlSetData($Button1, "已下载 " & Int($pro * 100) & "%")
EndFunc   ;==>Down
 楼主| 发表于 2015-7-8 22:28:38 | 显示全部楼层
求帮助啊。
发表于 2015-7-11 18:24:45 | 显示全部楼层
这个一般不可能。因为点击下载是网页写好的脚本,你点击download就会触发
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-4-30 02:39 , Processed in 0.079047 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表