的AppleScript福利局这里....使用AppleScript通过文本编辑
试图建立一个AppleScript将替换的几行代码从和.htm文件
这是为了替换在HTM文件文本难看,但作品:
tell application "Finder"
activate
tell application "System Events"
key down {command}
keystroke "a"
key up {command}
end tell
end tell
tell application "Finder"
activate
set fileCount to count files in front window
set fileCountAlert to fileCount
end tell
tell application "System Events"
tell process "Finder"
tell menu bar 1
tell menu bar item "File"
tell menu "File"
tell menu item "Open With"
tell menu "Open With"
click menu item "TextEdit"
end tell
end tell
end tell
end tell
end tell
end tell
delay 3
end tell
repeat until fileCount = 0
tell application "TextEdit"
activate
tell application "System Events"
key down {command}
keystroke "f"
key up {command}
--delay 1
keystroke "BORDER=1"
delay 0.5
keystroke tab
keystroke tab
keystroke "BORDER=0"
delay 0.5
key down {command}
keystroke "w"
key up {command}
delay 0.5
end tell
end tell
set fileCount to (fileCount - 1)
end repeat
tell application "Finder"
display dialog "Completed Adjusting " & fileCountAlert & " files."
end tell
我也尝试使用这样的事情....但是这件事情并没有在所有的工作....
set the search_document to (choose file)
replaceText("BORDER=1", "BORDER=0", search_document)
on replaceText(search_string, replacement_text, this_document)
tell application "TextEdit"
open this_document
set AppleScript's text item delimiters to the search_string
set this_text to the text of the front document as list
set AppleScript's text item delimiters to the replacement_text
set the text of the front document to (this_text as string)
close this_document saving yes
end tell
end replaceText
最后......我试图找出如何使用这样的事情单击AppleScript的按钮:
tell application "System Events"
tell process "TextEdit"
click button "All" of scroll area of window "3.htm"
end tell
end tell
**但是 - 我不断收到错误在这里。我正在使用UIElementInspector应用程序,但没有运气。
想知道如果任何人有ANNY快速帮助建议**