• 智能跳转---TC资源管理器


    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
    ;作者:天甜;QQ:105224583  
    ;一花一世界,一叶一枯荣,心无挂碍,无挂碍故,无有恐怖,远离颠倒梦想,究竟涅盘。  
    ;更新于:2016-10-10-20-36  
    ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;  
      
    Process, Priority,,high         ;脚本高优先级  
    #NoTrayIcon                         ;隐藏托盘图标  
    #NoEnv                              ;不检查空变量是否为环境变量  
    #Persistent                     ;让脚本持久运行(关闭或ExitApp)  
    #SingleInstance Force               ;跳过对话框并自动替换旧实例  
    #WinActivateForce                   ;强制激活窗口  
    #MaxHotkeysPerInterval 200      ;时间内按热键最大次数  
    SetBatchLines -1                    ;脚本全速执行  
    SetControlDelay 0                   ;控件修改命令自动延时  
    CoordMode Menu Window               ;坐标相对活动窗口  
    SendMode Input                      ;更速度和可靠方式发送键盘点击  
    SetTitleMatchMode 2             ;窗口标题模糊匹配  
    ;SetTitleMatchMode,RegEx  
    DetectHiddenWindows On              ;显示隐藏窗口  
    SetWorkingDir %A_ScriptDir%     ;当前脚本所在目录的绝对路径.不包含最后的反斜线(根目录同样如此);A_ScriptDir指的是D:zxhQuickZApps  
      
    ;另存为|保存|复制|新建|打开|图形另存为|文件打开|保存副本|上传|选择文件 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  
      
    global this_title=  
    global zParam  
    ;~ OnMessage(0x5555, "MsgMonitor")  
      
    ;在某些程序中自动切换中文,某些英文          注册个窗口钩子然后监听系统消息  
    Gui +LastFound +hwndhwndshellwindow  
    DllCall( "RegisterShellHookWindow", "UInt",hwndshellwindow )  
    OnMessage( DllCall( "RegisterWindowMessage", "Str", "SHELLHOOK" ), "SwitchMessage" )  
    return  
    ;~ MsgMonitor(wParam, lParam, msg)  
    ;~ {  
        ;~ zParam = %wParam%  
    ;~ }  
    ^+!1::zParam := 1  
    ^+!0::zParam := 0  
      
    SwitchMessage( wParam,lParam )  ;{  
    {  
        If ( wParam != 1 )      ;新开窗口  
        {  
        If WinActive("ahk_class TTOTAL_CMD")  
            {  
            WinWaitNotActive ahk_class TTOTAL_CMD  
            SendMessage 1074, 21, 0, , ahk_class TTOTAL_CMD  
            ControlGetText, varPathInTC, , ahk_id %ErrorLevel%  
            StringReplace, this_title, varPathInTC, >,   
            IfWinExist ahk_group Window32770  
                {  
                WinWaitActive ahk_group Window32770, , 2  
                if !ErrorLevel  
                ;IfWinActive ahk_group Window32770  
                    {  
                    ControlClick, Edit1, A  
                    Sleep, 100  
                    ControlSetText, Edit1, %this_title%, A  
                    Sleep, 50  
                    ControlSend, Edit1, {Enter}, A  
                    }  
                else  
                    return  
                }  
            else  
                return  
            return  
            }  
        If WinActive("ahk_class CabinetWClass")  
            {  
            WinWaitNotActive ahk_class CabinetWClass  
            WinGetTitle, this_title, ahk_class CabinetWClass    ;“文件夹选项”,“查看”,“在标题栏显示完整路径”,“确定”,显示完整路径  
            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  
                    {  
                    ControlClick, Edit1, A  
                    Sleep, 100  
                    ControlSetText, Edit1, %this_title%, A  
                    Sleep, 50  
                    ControlSend, Edit1, {Enter}, A  
                    }  
                else  
                    return  
                }  
            else  
                return  
            return  
            }  
        If WinActive("ahk_class SciTEWindow")  
            {  
            if zParam = 1  
                {  
                OCR_IBEAM           =32513  
                hbeam := DllCall("LoadCursorFromFile","Str","D:zxhQuickZUserIconszzx.cur")  
                DllCall( "SetSystemCursor", Uint,hbeam, Int,OCR_IBEAM )  
                }  
            if zParam = 0  
                {  
                SPI_SETCURSORS := 0x57  
                DllCall("SystemParametersInfo", "UInt", SPI_SETCURSORS, "UInt", 0, "UInt", 0, "UInt", 0)  
                }  
            WinWaitNotActive ahk_class SciTEWindow  
                {  
                SPI_SETCURSORS := 0x57  
                DllCall("SystemParametersInfo", "UInt", SPI_SETCURSORS, "UInt", 0, "UInt", 0, "UInt", 0)  
                }  
            return  
            }  
        }  
    }           ;}  
      
      
    >!o::  
        Send, ^o  
        WinWaitActive ahk_class #32770  
        ControlFocus, Edit1, A  
        send,{Backspace}  
        sleep 100  
        ControlSetText, Edit1, %this_title%, A  
        Sleep, 50  
        ControlSend, Edit1, {Enter}, A  
        return  
    >!l::  
        Send, ^+s  
        WinWaitActive ahk_class #32770  
        ControlFocus, Edit1, A  
        send,{Backspace}  
        sleep 100  
        ControlSetText, Edit1, %this_title%, A  
        Sleep, 50  
        ControlSend, Edit1, {Enter}, A  
        return  
    >!n::  
        Send, ^n  
        WinWaitActive ahk_class #32770  
        ControlFocus, Edit1, A  
        send,{Backspace}  
        sleep 100  
        ControlSetText, Edit1, %this_title%, A  
        Sleep, 50  
        ControlSend, Edit1, {Enter}, A  
        return  
    ;~ ^+s::  
        ;~ Send ^+s  
        ;~ WinWaitActive ahk_class #32770  
        ;~ ControlFocus, Edit1, A  
        ;~ send,{Backspace}  
        ;~ sleep 100  
        ;~ ControlSetText, Edit1, %this_title%, A  
        ;~ Sleep, 50  
        ;~ ControlSend, Edit1, {Enter}, A  
        ;~ return  
          
    #IfWinActive, ahk_class #32770  
    ^g::        ;发送最后 TC or 资管 路径到32770  
        ControlClick, Edit1, A  
        Sleep, 100  
        ControlSetText, Edit1, %this_title%, A  
        Sleep, 100  
        ControlSend, Edit1, {Enter}, A  
    return  
      
    ^e:: GoSub,Sub_SendCurDiagPath2Exp      ;在系统资管中打开对话框的路径  
    ^t:: GoSub,Sub_SendCurDiagPath2Tc       ;在TC中打开对话框的路径  
    ;~ Space & t:: GoSub,Sub_SendCurDiagPath2Tc  
    #If  
      
    ;将Explorer中路径发送到对话框  
    Sub_SendExpCurPath2Diag:  
    {  
        WinActivate ahk_class CabinetWClass  
        WinGetTitle, Title, ahk_class CabinetWClass ;打开“文件夹选项”,切换到“查看”选项卡,在高级设置列表框中勾选“在标题栏显示完整路径”,单击“确定”按钮使设置生效,现在访问文件夹路径时就会在左上角的标题栏显示完整路径  
        if Title=桌面  
            Title=%A_Desktop%  
        Send !{Tab}  
        ControlFocus, Edit1, A  
        send,{Backspace}  
        sleep 100  
        ControlSetText, Edit1, %Title%,A  
        send,{enter}  
    return  
    }  
    ;将tc中路径发送到对话框  
    Sub_SendTcCurPath2Diag:  
    {  
        clipraw:=Clipboard  
        Clipboard =  
        PostMessage, 1075, 2029,0,, ahk_class TTOTAL_CMD  
        ClipWait, 1  
        srcDIR := Clipboard  
        Clipboard:=clipraw  
      
        ;再发送剪贴板路径到控件  
        ControlFocus, Edit1, A  
        send,{Backspace}  
        sleep 100  
        ControlSetText, Edit1, %srcDIR%,A  
        send,{enter}  
    return  
    }  
    ;将tc中路径发送到对话框-备份  
    Sub_SendTcCurPath2Diag2:  
    {  
        ;将剪贴板中内容作为文件名  
        B_Clip2Name := false  
        B_ChangeDiagSize := true  
      
        ;先获取TC中当前路径  
        clip:=Clipboard  
        Clipboard =  
        ;TC_Msg := 1075,cm_CopySrcPathToClip 2029  
        PostMessage, 1075, 2029,0,, ahk_class TTOTAL_CMD  
        ClipWait, 1  
        srcDIR := Clipboard  
        Clipboard:=clip  
      
        ;再发送剪贴板路径到控件  
        ControlFocus, Edit1, A  
        send,{Backspace}  
        sleep 100  
        ControlSetText, Edit1, %srcDIR%,A  
        send,{enter}  
        ;msgbox %clip%  
        if(B_Clip2Name){  
            Sleep 100  
            ControlSetText, Edit1, %clip%,A  
        }  
        ;ControlSetText, Edit1, %text%,A  
        if(B_ChangeDiagSize){  
            ;WinGetPos, xTB, yTB,lengthTB,hightTB, ahk_class Shell_TrayWnd  
            ;改变对话框大小,省事就直接移动到100,100的位置,然后85%屏幕大小,否则就要详细结算任务栏在上下左右的位置  
            WinMove, A,,80,80, A_ScreenWidth * 0.85, A_ScreenHeight * 0.85  
        }  
    return  
    }  
    ;在TC中打开对话框的路径  
    Sub_SendCurDiagPath2Tc:  
    {  
        WinGetText, CurWinAllText  
        Loop, parse, CurWinAllText, `n, `r  
        {  
            If RegExMatch(A_LoopField, "^地址: "){  
                curDiagPath := SubStr(A_LoopField,4)  
                break  
            }  
        }  
        {  
        DiagPath := % curDiagPath  
        WinActivate ahk_class TTOTAL_CMD  
        PostMessage 1075, 3001, 0, , AHK_CLASS TTOTAL_CMD  
        ControlSetText, Edit1, cd %DiagPath%, ahk_class TTOTAL_CMD  
        Sleep 400  
        ControlSend, Edit1, {Enter}, ahk_class TTOTAL_CMD  
        }  
    return  
    }  
    ;在系统资管中打开对话框的路径  
    Sub_SendCurDiagPath2Exp:  
    {  
        WinGetText, CurWinAllText  
        Loop, parse, CurWinAllText, `n, `r  
        {  
            If RegExMatch(A_LoopField, "^地址: "){  
                curDiagPath := SubStr(A_LoopField,4)  
                break  
            }  
        }  
        {  
        DiagPath := % curDiagPath  
        run explorer.exe %DiagPath%  
        }  
    return  
    }  
      
      
    ^F12::Reload  
    ^F11::ExitApp 
  • 相关阅读:
    k.dbtool.engine v1.0.0.5 数据访问中间件 使用说明(一)
    OPEN(SAP) UI5 学习入门系列之四:更好的入门系列-官方Walkthrough
    OPEN(SAP) UI5 学习入门系列之三:MVC (下)
    OPEN(SAP) UI5 学习入门系列之三:MVC (上)
    OPEN(SAP) UI5 学习入门系列之二: 最佳实践练习(下)
    OPEN(SAP) UI5 学习入门系列之二: 最佳实践练习(上)
    OPEN(SAP) UI5 学习入门系列之一:扫盲与热身(下)
    OPEN(SAP) UI5 学习入门系列之一:扫盲与热身(上)
    开博第一篇
    浏览器缓存
  • 原文地址:https://www.cnblogs.com/zhanglei1371/p/6664892.html
Copyright © 2020-2023  润新知