我在AppleScript中制作了一些代码,以节省一些时间输入游戏中涉及的内容。代码非常重复,我不知道如何减少重复性。我对这种语言比较陌生,我不确定如何在Apple脚本中执行此操作。我想也许我可以在列表或字典中输入名字。
tell application "System Events"
delay 3.0 #Comment
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show Truthful_Demise"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen Truthful_demise"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show Medso"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen Medso"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show Amazed"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen Amazed"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show Xyrose"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen Xyrose"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show Banana"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen Banana"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show Affiliating"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen Affiliating"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show ValentinesDay"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen ValentinesDay"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show Haef"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen Haef"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show Cumulative"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen Cumulative"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show ChickenSpawner"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen ChickenSpawner"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show Curium"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen Curium"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show KeyLargo"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen KeyLargo"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show KeyWest"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen KeyWest"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show modso_246"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen modso_246"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show Anonymity"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen Anonymity"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show Absconding"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen Absconding"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show HeroArmour"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen HeroArmour"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show MothersDay"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen MothersDay"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show ModsoIsLove"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen ModsoIsLove"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show WinnDixie"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen WinnDixie"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show TheBreakfastClub"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen TheBreakfastClub"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show wolfwolfypower"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen wolfwolfypower"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show BreachedBase"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen BreachedBase"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show ValarieTheWeird"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen ValarieTheWeird"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show WitchSpawner"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen WitchSpawner"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show Akun"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen Akun"
keystroke return
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show ModsoIsLife"
keystroke return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen ModsoIsLife"
keystroke return
end tell
答案 0 :(得分:0)
是的,您可以将名称放在列表中,并使用循环来遍历列表
set myList to {"Truthful_demise", "Medso", "Amazed", "Xyrose", "Banana", "Affiliating", "ValentinesDay", "Haef", "Cumulative", "ChickenSpawner", "Curium", "KeyLargo", "KeyWest", "modso_246", "Anonymity", "Absconding", "HeroArmour", "MothersDay", "ModsoIsLove", "WinnDixie", "TheBreakfastClub", "wolfwolfypower", "BreachedBase", "ValarieTheWeird", "WitchSpawner", "Akun", "ModsoIsLife"}
tell application "System Events"
delay 3.0 #Comment
repeat with thisText in myList
delay 1.5
keystroke "t"
delay 0.1
keystroke "/f show " & thisText & return
delay 0.1
keystroke "t"
delay 0.1
keystroke "/seen " & thisText & return
end repeat
end tell