applescript脚本:safari与chorme书签互导

2018-04-01  本文已影响117人  passerbyli

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
上一篇 下一篇

猜你喜欢

热点阅读