【问题标题】:Change default naming conventions by windows explorer using AHKWindows Explorer 使用 AHK 更改默认命名约定
【发布时间】:2014-05-11 04:34:16
【问题描述】:

目前,在 Windows 资源管理器中突出显示和批量重命名文件/文件夹时发生的情况如下:

test(1).jpg
test(2).jpg
test(3).jpg

我如何编写一个脚本,以便突出显示文件/文件夹并点击相同的热键 (f2) 允许我更改命名约定?

变量 {space} ###.jpg

其中Variable是用户输入的名称,###是从001开始的运行顺序?

此外,当已有另一个同名文件时,我需要脚本来忽略警告。解决此问题的一种可能方法是首先将有问题的文件临时重命名为临时名称,以便重命名器可以继续其正确的顺序。

是的,我知道有许多功能强大的应用程序已经可以完成上述简单工作 - 但我不喜欢有 GUI(因为它很简单)。

感谢大家的帮助!

【问题讨论】:

  • 这个问题解决了吗?

标签: rename autohotkey explorer


【解决方案1】:

考虑这个例子:

#Include Explorer.ahk ;get it from : https://github.com/denolfe/AutoHotkey/blob/master/lib/Explorer.ahk

F2::
InputBox, Variable, Rename files, Enter your filename prefix.,, 250, 150,,,,,DefaultPrefix
path := Explorer_GetPath()
sel := Explorer_GetSelected()

MsgBox % sel
if ( StrLen(sel) && FileExist(path) )
{
    Loop, Parse, sel, `n
    {
        SetWorkingDir, %path%
        MsgBox  %A_loopfield%
        FileMove,  %A_loopfield%, %Variable%_%A_index%.*, 1 ; the '1' means Overwrite
    }
}
return

【讨论】:

  • 你好。我下载了 explorer.ahk 和你的脚本,但(显然)唯一有效的只是 msgbox。 win explorer 此后没有响应热键。
  • 您使用的是ahk v1.1吗?您的操作系统版本是多少?
  • 我使用的是 AHK 版本 v1.1.15.04,操作系统 Win 8.1 x64。 msgbox 刚刚弹出,用户无法输入。
  • hmmm 你在资源管理器中选择了一个文件,然后按 F2 吗?
  • 当然是的 - 给了我一堆弹出窗口,随后将其重命名为“BlahBlah”而不是用户输入。
猜你喜欢
  • 2023-04-05
  • 1970-01-01
  • 2020-12-11
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多