找回密码
 加入
搜索
查看: 6536|回复: 10

[IE类操作] 求助 如何取得IE菜单-的[文件]-->[另存为]无解了,求高人

  [复制链接]
发表于 2015-1-30 09:28:12 | 显示全部楼层 |阅读模式
AutoItSetOption("WinTitleMatchMode" , 2)     ;匹配标题: 1=开头, 2=子串, 3=完全, 4=高级 , -1 to -4=Nocase
AutoItSetOption("WinDetectHiddenText",0)        ;检测隐藏的窗口文本: 0 = 不检测隐藏文本(默认) 1 = 检测隐藏文本  

#Include <GuiToolBar.au3>
#include <IE.au3> 
#include <Array.au3>

$oIEhwnd = WinGetHandle ("[class:IEFrame]") 
if @Error Then
        Exit( msgbox(48,0,"不存IE窗口") )
Endif
;//激活IE
WinActivate ( $oIEhwnd )

;////////////////网页可以保存-但在网页内有其他ActiveX时失败/////////////
;/////////// 也就是说execCommand方法行不通/////////////
; $oIE    = _IEAttach ($oIEhwnd,"HWND")
; $oIEDoc = _IEDocGetObj ( $oIE )
; $oIEwin = $oIEDoc.ParentWindow
;$oIEwin.alert("ok")
;$oIEDoc.execCommand('SaveAs',true,'true');
;$oIEDoc.execCommand("SaveAs",True, _IEPropertyGet ( $oIE, "title" ) & ".txt" )
;///////////////////////////////////////

;取得Toolbar的HWND
;//$oMenuHwnd = ControlGetHandle($oIEhwnd, Default, "[CLASS:ToolbarWindow32; INSTANCE:4]")        ;//IE6
dim $hToolbar = ControlGetHandle( $oIEhwnd,Default,"[CLASS:ToolbarWindow32; INSTANCE:10]")        ;//IE8

$oCtlCount = _GUICtrlToolbar_ButtonCount($hToolbar)
for $i=0 to $oCtlCount - 1
        $iCommandID = _GUICtrlToolbar_IndexToCommand($hToolbar, $i)
        $t = _GUICtrlToolbar_GetButtonText($hToolbar, $iCommandID)
        msgbox(48, $i,  $iCommandID & @CR& $t )
next
#cs
;        0:        32768        文件(&F)        如何取得 文件菜单 下面 另存为 项的 CommandID进行调用操作
;        1:        32832        编辑(&E)
;        2:        32896        查看(&V)
;        3:        33136        收藏夹(&A)
;        4:        32960        工具(&T)
;        5:        33024        帮助(&H)
#ce
发表于 2015-1-30 09:40:15 | 显示全部楼层
为什么一定要点击,发送快捷键行不
发表于 2015-1-30 09:41:11 | 显示全部楼层
Send("^s")
发表于 2015-1-30 10:12:29 | 显示全部楼层
或用IE对象来操作
发表于 2015-1-30 10:12:46 | 显示全部楼层
$ie=ObjCreate("internetexplorer.application")
$ie.visible=true 
$ie.navigate("www.autoitx.com")
Sleep(10000)
$ie.document.execCommand("saveAs")
发表于 2015-1-30 10:34:05 | 显示全部楼层
WinMenuSelectItem可以操作菜单
发表于 2015-1-30 10:53:17 | 显示全部楼层
$hIEwnd = WinGetHandle ("[class:IEFrame]")
_GUICtrlMenu_GetMenu($hIEwnd)
 楼主| 发表于 2015-1-30 15:56:41 | 显示全部楼层
一. ie doc的execcommand方法已测试. 无法成功保存.回ie与一公文程序融合显示. 貌似更改了ie的一些显示
二. WinMenuSelectItem根本无法操作. 现在ie的菜单. 至少是ie6和8的菜单都非标准的菜单. 而是toolbar32的popup弹出式的菜单
三. 快捷捷的方式到是肯定可用. 但用户在操作. 还是希望能从内部取得.句柄中命令id实现内部调用.谢谢
发表于 2015-1-30 16:25:36 | 显示全部楼层
本帖最后由 zhouhaijin 于 2015-1-30 16:37 编辑

希望的方式等高手来回答吧。
解决后公布下方法也让大家学习下。 加油!
发表于 2015-2-4 00:58:09 | 显示全部楼层
楼主最后怎么解决的。
发表于 2015-2-5 10:03:42 | 显示全部楼层
用inetget不行吗
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-5-5 09:46 , Processed in 0.077447 second(s), 23 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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