AppleScript newb here....
および .htm ファイルから数行のコードを置き換える AppleScript をセットアップしようとしています
これは醜いですが、動作します:
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 アプリを使用していますが、うまくいきません。
誰かが簡単なヘルプの提案を持っているかどうか疑問に思っていますか? **