Recover links sessionrestore3/16/2023 ![]() ![]() I have this script saved as “EverSave.scpt” in my ~/Library/Scripts/Applications/Safari folder (create it if you don’t have it), and launch it using FastScripts with a Command-Shift-S shortcut. Property _ template : "⇑ %name %url >" -search and replace function for template on snr ( tofind, toreplace, TheString ) set ditd to text item delimiters set text item delimiters to tofind set textItems to text items of TheString set text item delimiters to toreplace if ( class of TheString is string ) then set res to textItems as string else - if (class of TheString is Unicode text) then set res to textItems as Unicode text end if set text item delimiters to ditd return res end snr set prettyDate to do shell script "date '+%A, %B %d, %Y at %l:%M %p'" set theTitle to "Bookmarks " & prettyDate set urlList to "" tell application "Safari" set tabList to every tab of front window repeat with aTab in tabList set aLink to _ template set aLink to my snr ( "%name", name of aTab, aLink ) set aLink to my snr ( "%url", URL of aTab, aLink ) set urlList to urlList & aLink & return end repeat end tell set urlList to urlList & "" tell application "Evernote" set theNote to create note with html urlList title theTitle notebook "Bookmarks" end tell See the original EverSave post for a breakdown of the script.īe sure to continue reading after the script to see how we handle the “restore” functionality. Just keep in mind that Evernote strips 90% of markup out when it creates the note from your HTML, so stick with basic tags. With a little bit of HTML (remember to escape your double quotes), you can modify the template to look however you like. I’m posting the whole thing again, with this minor revision, for convenience. The actual layout is still fully controlled by the _template property in the first line, which is the only line that’s changed from the original script. I did my best to minimize the visual presence of the URL using the rudimentary markup that Evernote actually pays attention to. It’s not the prettiest solution, but it’s the only way that this particular system will work. What I ended up doing was modifying what EverSave stored, and including the actual URL in the visible text of the note. It’s not impossible, but I quickly decided it wasn’t a route I wanted to wander down. Once it’s stored in Rich Text Format (RTF), manipulating it via any shell language, including AppleScript, becomes quite difficult. When I decided to fix this, the first issue was that when EverSave creates the Evernote note, it lets Evernote convert the list from HTML to Rich Text. One thing’s been bugging me, though, and that’s the inability to do a mass restore on a tab list (i.e. However, I’ve found I still like using my EverSave script in many situations, primarily because it allows me to annotate, tag and sync my important sessions for later retrieval. Safari 5 has brought several solutions for managing lists of open tabs, from the simple (like my TabLinks extension) to full session-management capabilities (see the beautiful Sessions extension).
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |