Refetch Web Page

Summary: Re-downloads the Web pages for the selected records.
Requires: EagleFiler
Install Location: ~/Library/Scripts/Applications/EagleFiler/
Last Modified: 2019-10-02

Description

This script creates new Web archives (or whichever Web page format you chose in the preferences) for the selected records. It can be used to convert bookmarks to Web archives, to download the latest versions of pages that may have been updated, and more. The metadata is transferred to the new Web archives.

Installation Instructions · Download in Compiled Format · Download in Text Format

Script

on run
    
tell application "EagleFiler"
        
set _selection to selected records of browser window 1
        
repeat with _record in _selection
            
my refetchWebPage(_record)
        
end repeat
    
end tell
end run

on refetchWebPage(_record)
    
tell application "EagleFiler"
        
set _url to _record's source URL
        
if _url is "" then return
        
try
            
set {_newRecord} to import URLs {_url}
        
on error
            
return -- Error fetching page; move on to the next one
        
end try
        
set _newRecord's container to _record's container
        
set note text of _newRecord to _record's note text -- does not preserve rich text
        
set _tags to _record's assigned tags
        
set assigned tags of _newRecord to _tags
        
set title of _newRecord to _record's title
        
set from name of _newRecord to _record's from name
        
set label index of _newRecord to _record's label index
    
end tell
end refetchWebPage