Autohotkey 循环内循环-检测自动热键中的循环结束
假设我有一堆文件名,里面有水果的名字。我想根据一个充满参考文件的文件夹(虚拟txt文件,其中包含水果名称、句号,然后是甜点名称)自动重命名它们 苹果、馅饼、葡萄、果冻、猕猴桃、蛋糕、芒果、冰淇淋、香蕉、布丁、樱桃、皮匠等 我想选择所有要重命名的文件,并将它们拖到我的脚本上Autohotkey 循环内循环-检测自动热键中的循环结束,autohotkey,nested-loops,Autohotkey,Nested Loops,假设我有一堆文件名,里面有水果的名字。我想根据一个充满参考文件的文件夹(虚拟txt文件,其中包含水果名称、句号,然后是甜点名称)自动重命名它们 苹果、馅饼、葡萄、果冻、猕猴桃、蛋糕、芒果、冰淇淋、香蕉、布丁、樱桃、皮匠等 我想选择所有要重命名的文件,并将它们拖到我的脚本上 如果循环中的某个文件已经包含某个组合,例如“cherry.cobbler”,我只希望该dummy文件被丢弃,并且该文件不应重命名为“cherry.cobbler.cobbler” 如果循环中的文件包含单词“kiwi”,我希望对
Loop %0%
{
Path := %A_Index%
Loop %Path%, 1
LongPath = %A_LoopFileLongPath%
SplitPath LongPath, OutFileName, OutDir, OutExtension, OutNameNoExt, OutDrive
Loop thru folder of fruit combos
{
Stringsplit filenames from fruit-combos folder into %fruit% and %dessert%
If OutNameNoExt contains %fruit%.%dessert%
{
FileDelete fruit.combo dummyfile
continue; skip to next file to rename
)
If OutNameNoExt contains %fruit%
{
FileDelete fruit.combo dummyfile
StringReplace %fruit% with %fruit%.%dessert%
continue; skip to next file to rename
)
If OutNameNoExt not contains fruit.combo AND all dummy files have been checked
{
StringReplace %fruit% with %fruit%.nodessert
)
}
; proceed with next selected file
}
把条件3放在内环外,它似乎起作用了