要从Dock中移除项目,可以使用AppleScript脚本编写以下代码示例:
tell application "System Events"
    -- 获取Dock的进程
    set dockProcess to first process whose bundle identifier is "com.apple.dock"
    
    -- 获取Dock中的项目列表
    set dockItems to value of attribute "AXChildren" of UI element 1 of dockProcess
    
    -- 遍历项目列表
    repeat with dockItem in dockItems
        -- 获取项目的名称
        set itemName to value of attribute "AXTitle" of dockItem
        
        -- 如果项目名称与指定的名称匹配,则从Dock中移除该项目
        if itemName is "应用程序的名称" then
            -- 移除项目
            delete dockItem
        end if
    end repeat
end tell
请注意,你需要将"应用程序的名称"替换为你要移除的应用程序的准确名称。你可以将脚本保存为脚本文件,然后使用AppleScript编辑器或直接将其复制到脚本编辑器中运行。运行脚本后,应用程序将从Dock中移除。