Reload Web Pages

Summary: Updates the selected records with the latest Web content.
Requires: EagleFiler
Install Location: ~/Library/Scripts/Applications/EagleFiler/
Last Modified: 2019-10-02

Description

This script downloads fresh copies of the selected records’ Web pages and moves the old files to the trash.

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

Script

tell application "EagleFiler"
    
set _records to selected records of browser window 1
    
repeat with _record in _records
        
my reloadWebPage(_record)
    
end repeat
end tell

on reloadWebPage(_record)
    
tell application "EagleFiler"
        
set _url to _record's source URL
        
set _container to _record's container
        
tell _record's library document to import URLs {_url}
        
set _newRecord to item 1 of the result
        
set _trash to trash of _record's library document
        
set _record's container to _trash
        
set _newRecord's container to _container
        
my copyMetadata(_record, _newRecord)
    
end tell
end reloadWebPage

on copyMetadata(_source, _dest)
    
tell application "EagleFiler"
        
set note text of _dest to _source's note text
        
set _tags to _source's assigned tags
        
set assigned tags of _dest to _tags
        
set title of _dest to _source's title
        
set label index of _dest to _source's label index
    
end tell
end copyMetadata