找回密码
 加入
搜索
查看: 3827|回复: 5

[IE类操作] 加了延迟后没办法关掉IE进程!(已解决)

[复制链接]
发表于 2010-5-19 10:26:22 | 显示全部楼层 |阅读模式
本帖最后由 xiaosu 于 2010-5-19 14:55 编辑

延迟1000毫秒以后就没办法关掉。不过300毫秒的时候就会关闭IE了。代码如下。那位大虾帮忙看看
FileWrite("C:\Documents and Settings\Administrator\桌面\脚本\wglm.net.txt","wglm.net.asd")
FileMove("C:\Documents and Settings\Administrator\桌面\脚本\wglm.net.txt","C:\Documents and Settings\Administrator\桌面\脚本\bbs.wglm.net.txt",1)
RunWait("C:\Program Files\Internet Explorer\iexplore")
Sleep(500)
ProcessExists("IEXPLORE.exe")
ProcessClose("IEXPLORE.exe")
发表于 2010-5-19 11:00:13 | 显示全部楼层
那就不是延迟的事。  是runwait的事。。  你查下这个函数的说明。

运行一个外部程序并暂停脚本的执行直至该程序执行完毕.

看懂了没??? 直到外部程序结束才继续。。

你的代码应该改为:
FileWrite("C:\Documents and Settings\Administrator\桌面\脚本\wglm.net.txt","wglm.net.asd")
FileMove("C:\Documents and Settings\Administrator\桌面\脚本\wglm.net.txt","C:\Documents and Settings\Administrator\桌面\脚本\bbs.wglm.net.txt",1)
Run("C:\Program Files\Internet Explorer\iexplore.exe")
Sleep(500)
If ProcessExists("IEXPLORE.exe") Then ProcessClose("IEXPLORE.exe")
 楼主| 发表于 2010-5-19 12:26:56 | 显示全部楼层
哦。。谢谢啊。。
要是在加上打开浏览器后。。让他自动输入一个网址的代码要怎么写呢???
 楼主| 发表于 2010-5-19 12:30:24 | 显示全部楼层
FileWrite("C:\Program Files\Internet Explorer\iexplore.exe","bbs.wglm.net")我是这么写。。但是他只是打开IE。。没完成输入
发表于 2010-5-19 13:43:34 | 显示全部楼层
和明显楼主用Filewrite就大错特错了.
看列子!
; *******************************************************
; Example 1 - Create a browser window and navigate to a website
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com")

; *******************************************************
; Example 2 - Create new browser windows pointing to each of 3 different URLs
;                                if one does not already exist ($f_tryAttach = 1)
;                                do not wait for the page loads to complete ($f_wait = 0)
; *******************************************************
;
#include <IE.au3>
_IECreate ("www.autoitscript.com", 1, 1, 0)
_IECreate ("my.yahoo.com", 1, 1, 0)
_IECreate ("www.google.com", 1, 1, 0)

; *******************************************************
; Example 3 - Attempt to attach to an existing browser displaying a particular website URL
;                                Create a new browser and navigate to that site if one does not already exist
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("www.autoitscript.com", 1)
; Check @extended return value to see if attach was successful
If @extended Then
        MsgBox(0, "", "Attached to Existing Browser")
Else
        MsgBox(0, "", "Created New Browser")
EndIf

; *******************************************************
; Example 4 - Create an empty browser window and populate it with custom HTML
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ()
$sHTML = "<h1>Hello World!</h1>"
_IEBodyWriteHTML ($oIE, $sHTML)

; *******************************************************
; Example 5 - Create an invisible browser window, navigate to a website,
;                                retrieve some information and Quit
; *******************************************************
;
#include <IE.au3>
$oIE = _IECreate ("http://sourceforge.net", 0, 0)
; Display the innerText on an element on the page with a name of "sfmarquee"
$oMarquee = _IEGetObjByName ($oIE, "sfmarquee")
MsgBox(0, "SourceForge Information", $oMarquee.innerText)
_IEQuit ($oIE)

; *******************************************************
; Example 6 - Create a browser window attached to a new instance of iexplore.exe
;                                This is often necessary in order to get a new session cookie context
;                                (session cookies are shared among all browser instances sharing the same iexplore.exe)
; *******************************************************
;
#include <IE.au3>
ShellExecute ("iexplore.exe", "about:blank")
WinWait ("Blank Page")
$oIE = _IEAttach ("about:blank", "url")
_IELoadWait ($oIE)
_IENavigate ($oIE, "www.autoitscript.com")
 楼主| 发表于 2010-5-19 14:54:59 | 显示全部楼层
感谢kemyliu和lanfengc 。都解决了我的难题。。
kemtliu  6个例子是每个运行的都不同。。
也直接解决了我后面的问题。。
感谢
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-11-17 00:41 , Processed in 0.083494 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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