Ok… I’m taking the easy way out by posting a message here.
I am trying to develop an AppleScript for the first time with Safari browser.
I need a script that will automatically get HTML source of the current page and copy and paste that source into either TextEdit or BBEdit.
I can’t seem to find the proper term to copy and paste. Here’s what I wrote so far - pathetic, I know. Recording in AppleScript Editor doesn’t work with Safari.
tell application “Safari”
activate
set page_source to the source of document
end tell
tell application “TextEdit”
activate
try
set document to page_source
end try
end tell
tell application "Safari"
activate -- not needed unless you want to watch
set page_source to the source of front document
end tell
tell application "TextEdit"
activate -- not needed unless you want to watch
set newDoc to make new document at end
tell newDoc
set paragraph 1 to page_source
end tell
end tell
Yeah, the terminology is different. This works with BBEdit 6.5.x. so I assume it will work with v7.x.
tell application "Safari"
activate
set page_source to the source of front document
end tell
tell application "BBEdit 7.0.1"
activate
make new text window with properties {contents:page_source}
end tell