【发布时间】:2015-05-30 13:26:33
【问题描述】:
有没有办法让 AppleScript 自动输入以下内容:
aaaaaaaa,然后 aaaaaaab,然后 aaaaaaac,一直到 zzzzzzzz?
这是那些简单的功能之一,但很难弄清楚(至少对我来说)。 :/
【问题讨论】:
-
你的意思是一下子吗?多个特定长度的字符串?都在同一条线上?每个字符串一行?
标签: automation applescript character
有没有办法让 AppleScript 自动输入以下内容:
aaaaaaaa,然后 aaaaaaab,然后 aaaaaaac,一直到 zzzzzzzz?
这是那些简单的功能之一,但很难弄清楚(至少对我来说)。 :/
【问题讨论】:
标签: automation applescript character
你想要的是一个排列处理程序,但我不确定你是否真的想运行那组排列,你有七个 char 位置,每个位置有 26 种可能性,总共有 7^26,或者9^21 不同的行,这是一个相当大的集合。不过,你应该可以在这里找到合适的处理程序http://macscripter.net/viewtopic.php?id=30365&p=1
【讨论】:
这是一个嵌套的重复工作流程,可以完成您想要的工作。它会运行很长时间。
tell application "TextEdit"
activate
make new document
end tell
set ls to {"a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z"}
set theResult to {}
repeat with n1 from 1 to 26
set c1 to item n1 of ls
repeat with n2 from 1 to 26
set c2 to item n2 of ls
repeat with n3 from 1 to 26
set c3 to item n3 of ls
repeat with n4 from 1 to 26
set c4 to item n4 of ls
repeat with n5 from 1 to 26
set c5 to item n5 of ls
repeat with n6 from 1 to 26
set c6 to item n6 of ls
repeat with n7 from 1 to 26
set c7 to item n7 of ls
repeat with n8 from 1 to 26
set c8 to item n8 of ls
set r to (c1 & c2 & c3 & c4 & c5 & c6 & c7 & c8 as string)
-- can write each iteration somewhere:
keystrokeThis(r)
-- or, just save to a list variable all at once and then later process the list:
set theResult to theResult & r
end repeat
end repeat
end repeat
end repeat
end repeat
end repeat
end repeat
end repeat
-- you now have all your strings in theResult as a list and can do things with it as a whole
on keystrokeThis(s)
tell application "System Events"
tell process "TextEdit"
keystroke s & return
end tell
end tell
end keystrokeThis
【讨论】: