Ajout de signets pour plusieurs onglets dans Safari avec un raccourci clavier


Réponses:


1

Vous pouvez utiliser ce AppleScript; il crée un script shell contenant les liens de tous les onglets de la fenêtre Safari actuelle:

-- Set the default folder to Home -> bookmarks
set bookmarkFolder to "/bookmarks"
set username to do shell script "whoami"
set defaultFolder to POSIX file ("/Users/" & username & bookmarkFolder)

-- Initialize the text ot the script.
set cmd to "#!/bin/bash" & linefeed & linefeed

-- Add commands to open all the tabs.
tell application "Safari"
    set n to count of tabs in front window
    repeat with i from 1 to n
        set cmd to cmd & "open -g " & URL of tab i of front window & linefeed
    end repeat
end tell

-- Open/create a file and save the script.

tell me
    activate
    set scriptAlias to choose file name default name "tabset" default location (defaultFolder as alias)
end tell
set scriptPath to quoted form of POSIX path of scriptAlias
set scriptFile to open for access scriptAlias with write permission
set eof scriptFile to 0
write cmd to scriptFile starting at eof
close access scriptFile

-- Change the file attributes to make it double-clickable.
do shell script "chmod 777 " & scriptPath
do shell script "xattr -wx com.apple.FinderInfo '00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00' " & scriptPath

La version originale est par le Dr Drang .

J'ai changé deux choses:

  • le script autorise les espaces dans le nom du fichier
  • le dossier par défaut est ~/bookmarks

Pour l’exécuter, vous pouvez soit utiliser un lanceur (comme Quicksilver ou Butler ) ou envelopper dans un System Service avec Automator:

  • créer le service
    • ajouter un Run Applescript article
    • sélectionner Service receives pas d'entrée in Safari
    • coller le AppleScript
  • créer un raccourci dans System Preferences > Keyboard > Shortcuts > Services
    • ⌘⌥D ne fonctionne pas si vous l'utilisez pour basculer la visibilité du Dock

enter image description here

En utilisant notre site, vous reconnaissez avoir lu et compris notre politique liée aux cookies et notre politique de confidentialité.
Licensed under cc by-sa 3.0 with attribution required.