Hi Guys,
I am using Safari version 14.1.2 and macOS Mojave version 10.14.6
I am working with many windows in Safari as well as Google Chrome. I would like to routinely (certain time) refresh some particular window of some particular tab and to save it as HTML File without disturbing other windows.
The below code works up to 80% of my need. Whereas its brings the target window as frontmost window. Which disturbing while working in another window
set someurl to “Google”
tell application “Safari”
–activate
set myID to id of window 1
set myTab to current tab of window 1
set thename to name of window 1
end tell
repeat
tell application “Safari”
set index of window id myID to 1
set URL of myTab to someurl
if document 1 exists then
set theDocumentTitle to the name of document 1
set theDocumentSource to the source of document 1
tell application “TextWrangler”
–activate
set theNewDocument to make new document with properties {name:theDocumentTitle, text:theDocumentSource}
set theDocumentsFolderPath to the path to desktop as text
set theSaveFilePath to theDocumentsFolderPath & theDocumentTitle & “.html”
save theNewDocument to file theSaveFilePath
close theNewDocument
end tell
end if
end tell
delay 20
end repeat
Is there any script to fulfill my need for both Safari and Google Chrome?
Any help would be appreciated
Thanks,
John