复制TC当前路径到保存对话框

;功能:把TC的当前目录路径或文件完整路径复制到对话框
;使用方法:弹出对话框后,激活TC,进入需要的目录或选中需要的文件后,按#s(可自定义)
;Title_CopyDirPath是对话框(需要目录路径的)标题关键字列表,用|隔开,遇到不识别的对话框可自行添加
;Title_CopyFilePath是对话框(需要文件路径)标题关键字列表,同上可自定义
;其他可能问题:1、如存在多个类似对话框,可能会激活了其他窗口。建议一个一个来。
              ;2、可能有些对话框,输入目录路径回车后目录不会跳转,不明是什么原因。
;本脚本没啥技术含量,有任何好的实现方式或建议,请告知。QQ:85399416 火冷。

SetTitleMatchMode 2
#SingleInstance force

#s::
;情形1:选择目录的对话框
Title_CopyDirPath := "另存为|保存|复制|新建|Ahk_exe 7zFM.exe"
Loop, Parse, Title_CopyDirPath, |
{
    IfWinNotExist %A_LoopField%
        Continue
    HyF_TCSendPos("2029") ;复制目录路径
    WinActivate
    WinWaitActive, %A_LoopField%, , 0.5
    If ErrorLevel
    {
        WinGet, Path_Tmp, ProcessPath, %A_LoopField%
        MsgBox,% "窗口:" . A_LoopField . "`n激活失败,影响窗口路径为`n" . Path_Tmp
        Return
    }
    ControlSend, Edit1, {Shift Down}{Ins}{Shift Up}{Enter}, %A_LoopField%
    Sleep, 100
    If !InStr(A_LoopField, "7zFM")
        Send, {Enter}
    Return
}

;情形2:选择文件的对话框,TC选中文件后按快捷键
Title_CopyFilePath := "打开|上传"
Loop, Parse, Title_CopyFilePath, |
{
    IfWinNotExist %A_LoopField%
        Continue
    HyF_TCSendPos("2018") ;复制文件路径
    WinActivate
    WinWaitActive, %A_LoopField%, , 0.5
    If ErrorLevel
    {
        WinGet, Path_Tmp, ProcessPath, %A_LoopField%
        MsgBox,% "窗口:" . A_LoopField . "`n激活失败,影响窗口路径为`n" . Path_Tmp
        Return
    }
    ControlSend, Edit1, {Shift Down}{Ins}{Shift Up}{Enter}, %A_LoopField%
    Return
}
MsgBox, 对话框没识别到,请检测关键字
Return

HyF_TCSendPos(num)
{
    PostMessage, 1075, %num%, 0, , ahk_class TTOTAL_CMD
}

给TA捐赠
共{{data.count}}人
人已捐赠
其他

在线翻译

2020-3-9 1:57:44

其他

复制整行到剪贴板!g

2020-3-9 1:59:44

个人中心
购物车
优惠劵
今日签到
有新私信 私信列表
搜索