浏览器自动跳转

#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.  
; #Warn  ; Enable warnings to assist with detecting common errors.  
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.  
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.  
#SingleInstance,force  
Menu, Tray, Icon, shell32.dll, 151
;另存为|保存|复制|新建|打开|图形另存为|文件打开|保存副本|上传|选择文件 ahk_class #32770  
GroupAdd,Window32770,另存为 ahk_class #32770  
GroupAdd,Window32770,保存 ahk_class #32770  
GroupAdd,Window32770,复制 ahk_class #32770  
GroupAdd,Window32770,新建 ahk_class #32770  
GroupAdd,Window32770,打开 ahk_class #32770  
GroupAdd,Window32770,图形另存为 ahk_class #32770  
GroupAdd,Window32770,文件打开 ahk_class #32770  
GroupAdd,Window32770,打开文件 ahk_class #32770  
GroupAdd,Window32770,保存副本 ahk_class #32770  
GroupAdd,Window32770,上传 ahk_class #32770  
GroupAdd,Window32770,选择文件 ahk_class #32770  
GroupAdd,Window32770,插入图片 ahk_class #32770  
GroupAdd,Window32770,导入 ahk_class #32770  
GroupAdd,Window32770,置入嵌入对象 ahk_class #32770  
;~ ----------------------------------------------------
GroupAdd,Window32770 , ahk_class bosa_sdm_Microsoft Office Word 11.0
GroupAdd, Window32770 , ahk_class bosa_sdm_XL9
GroupAdd, Window32770 , ahk_class bosa_sdm_Mso96
 
;在某些程序中自动切换中文,某些英文 注册个窗口钩子然后监听系统消息  
Gui +LastFound +hwndhwndshellwindow  
DllCall( "RegisterShellHookWindow", "UInt",hwndshellwindow )  
OnMessage( DllCall( "RegisterWindowMessage", "Str", "SHELLHOOK" ), "SwitchMessage" )  
return  
 
  


SwitchMessage( wParam,lParam ) ;{ 

    if ( wParam != 1 ) ;新开窗口 
    { 
        if WinActive("ahk_class CabinetWClass") ;若激活了桌面; 
        { 
            WinWaitNotActive ahk_class CabinetWClass ;等待桌面失活; 
            ;以下三种方法是获取地址栏文本,也就是路径; 
            ; 方法一 
            ;WinGetTitle, this_title, ahk_class CabinetWClass ;“文件夹选项”,“查看”,“在标题栏显示完整路径”,“确定”,显示完整路径 
            ; 方法二 
            ;hExplorer := DllCall("FindWindowEx", Int, 0, Int, 0, Str, "CabinetWClass", Int, 0) 
            ;hAddressBar := DllCall("FindWindowEx", Int, hExplorer, Int, 0, Str, "ShellTabWindowClass", Int, 0) 
            ;ControlGetText, path, , ahk_id %hAddressBar% 
            ; 方法三 
            ControlGetText, this_title, ToolbarWindow322, ahk_class CabinetWClass 
            this_title := StrReplace(this_title, "地址:", "") 
            if this_title=桌面 
                this_title=%A_Desktop% 
            ;if this_title=库\文档 
            ;this_title=%A_MyDocuments% 
            IfWinExist ahk_group Window32770 
            { 
                WinWaitActive ahk_group Window32770, , 2 
                if !ErrorLevel 
                {
                ;IfWinActive ahk_group Window32770 
                WinGetClass,w_Class,A
                    if w_Class not contains bosa_sdm_  ;Office对话框
                        { 
                           ControlFocus, Edit1, A 
                            ControlSetText, Edit1, %this_title%, A 
                            Sleep, 50 
                            ControlSend, Edit1, {Enter}, A  
                        }  
                    else
                        { 
                         ControlSetText, RichEdit20W2, %this_title%, A 
                            Sleep, 50 
                            ControlSend, RichEdit20W2, {Enter}, A  
                        }}  
                else  
                    return  
            }  
            else  
                return  
            return  
        }  
}  
}   




  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值