美文网首页
applescript脚本:safari与chorme书签互导

applescript脚本:safari与chorme书签互导

作者: passerbyli | 来源:发表于2018-04-01 15:12 被阅读117次

applescript Safari导入chorme的书签

set SecondsDelay to 0.1

tell application "Safari" to activate
delay SecondsDelay
tell application "Safari" to close windows

tell application "System Events" to tell process "Safari"
    tell menu item "Import From" of menu "File" of menu bar item "File" of menu bar 1
        tell menu "Import From"
            click menu item "Google Chrome…"
        end tell
    end tell
    tell window "Import from Google Chrome"
        click button "Import"
    end tell
end tell

applescript chorme导入Safari的书签

tell application "System Events" to tell process "Google Chrome"
    tell application "Google Chrome"
        set bookmarks to {}
        repeat with i from 1 to count of bookmark folders of bookmark folder "Bookmarks Bar"
            set bookmark to item i of bookmark folders of bookmark folder "Bookmarks Bar"
            set bookmarkName to title of bookmark
            copy bookmarkName to end of bookmarks
        end repeat
        
        repeat with i from 1 to count of bookmarks
            set bookmark to item i of bookmarks
            set folderToDelete to bookmark folder bookmark of bookmark folder "Bookmarks Bar"
            delete folderToDelete
        end repeat
    end tell
    
    set frontmost to true
    tell menu bar item "Chrome" of menu bar 1
        click
        set menuItem to menu item "Import Bookmarks and Settings…" of menu 1
        click menuItem
    end tell
end tell

相关文章

网友评论

      本文标题:applescript脚本:safari与chorme书签互导

      本文链接:https://www.haomeiwen.com/subject/fhtacftx.html