AutoHotkey - 仅通过选择图像并按快捷键按所需名称重命名图像

AutoHotkey - Rename image by desired name only by selecting it and pressing shortcut

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

所以我只想 select 图像并用一个字母的快捷方式(例如 "L")将它重命名(不管它以前的名字)到 "LAYOUT"

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