applescript脚本:safari与chorme书签互导

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 chorme导入Safari的书签(简体中文下)

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 "导入自" of menu "文件" of menu bar item "文件" of menu bar 1
        tell menu "导入自"
            click menu item "谷歌 Chrome…"
        end tell
    end tell
    tell window "从谷歌 Chrome 导入"
        click button "导入"
    end tell
end tell

你可能感兴趣的:(applescript脚本:safari与chorme书签互导)