【问题标题】:AutoHotkey - Rename image by desired name only by selecting it and pressing shortcutAutoHotkey - 仅通过选择图像并按下快捷方式以所需名称重命名图像
【发布时间】:2016-06-15 00:52:26
【问题描述】:

我有一个井井有条的工作流程,并且我的图像始终需要具有相同的名称。它始终是 PNG(便携式网络图形),无论它是在桌面上还是在文件夹中。

所以我只想选择图像并使用一个字母快捷方式(例如“L”)将其重命名(无论它是以前的名称)为“LAYOUT”

【问题讨论】:

    标签: png keyboard-shortcuts autohotkey file-rename


    【解决方案1】:
    F2::
    ClipSaved := ClipboardAll       ; save the entire clipboard to the variable ClipSaved
    clipboard := ""                 ; empty clipboard
    Send, ^c                        ; copy the selected file
    ClipWait, 1                     ; wait for the clipboard to contain data
    if (!ErrorLevel)                ; If NOT ErrorLevel clipwait found data on the clipboard
    {
        clipboard := clipboard      ; convert to text (= copy the path of the selected file)
        Sleep, 300 
        ; MsgBox, %clipboard%       ; display the path
        if (SubStr(clipboard, -2) != "png")
        {
            MsgBox, No PNG-file selected
            clipboard := ClipSaved
                return
        }
        ; otherwise:
        SplitPath, clipboard, name, dir
        FileMove, %clipboard%, %dir%\LAYOUT.png
        Sleep, 100
        clipboard := ClipSaved       ; restore original clipboard
    }
    else
    {
        MsgBox, No file selected
        clipboard := ClipSaved 
    }
    return
    

    【讨论】:

    • "user3419297" 你是上帝!谢谢!
    猜你喜欢
    • 2021-10-19
    • 2013-09-11
    • 1970-01-01
    • 2019-04-18
    • 1970-01-01
    • 2011-01-17
    • 1970-01-01
    • 2015-03-17
    • 2017-06-30
    相关资源
    最近更新 更多