惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

U
Unit 42
Google DeepMind News
Google DeepMind News
Stack Overflow Blog
Stack Overflow Blog
H
Help Net Security
MongoDB | Blog
MongoDB | Blog
I
InfoQ
N
Netflix TechBlog - Medium
T
Tailwind CSS Blog
量子位
博客园 - 叶小钗
月光博客
月光博客
IT之家
IT之家
G
Google Developers Blog
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
小众软件
小众软件
S
SegmentFault 最新的问题
Engineering at Meta
Engineering at Meta
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
aimingoo的专栏
aimingoo的专栏
云风的 BLOG
云风的 BLOG
Vercel News
Vercel News
爱范儿
爱范儿
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
宝玉的分享
宝玉的分享

博客园 - meetrice

XygoAdmin 学习笔记 iterm2配置千问ai 自用大模型响应速度不完全评测 vscode cursor 必装插件 RSS平台需求分析报告 uniapp 打包 ios 问题 360加固uniapp Link Symbol Comment 在注释中跳转到函数的vs插件(已开源) mac 下最好的五笔输入法 小企鹅输入法 FCITX uniapp 使用原生号码一键认证后,安卓改名流程 mac 的任务栏 Windows-Style Taskbar For macOS keyboard Maestro Editor 的Applescript 打开终端执行命令 高性价比算力平台恒源云 显卡3090-24G 只要0.94元/小时,安装千问Qwen2.5-VL-7B进行图片理解 上手全记录 AI自主交互功能的大模型协同框架 广告图像分类算法 xcv mac mini m4常用配置 claude code windows设置 gpt5的主要升级有哪些 mac mini m4 用putty连接中文乱码 echo 'export LANG="zh_CN.UTF-8"'>> ~/.zshrc source ~/.zshrc
apple script 激活指定的vscode的窗口,以‘notes’开头的窗口
meetrice · 2026-02-04 · via 博客园 - meetrice
tell application "System Events"
    try
        -- 优先通过 bundle identifier 获取 VSCode 进程,必要时回退到名称匹配
        set vscodeProcesses to {}
        try
            set vscodeProcesses to every application process whose bundle identifier is "com.microsoft.VSCode"
        end try
        if (count of vscodeProcesses) is 0 then
            set vscodeProcesses to every application process whose name contains "Code"
        end if
        if (count of vscodeProcesses) is 0 then return "❌ 未找到正在运行的 VSCode"
        
        -- 统计被激活的 notes 窗口数量
        set notesWindowCount to 0
        
        repeat with proc in vscodeProcesses
            try
                set windowList to windows of proc
                repeat with w in windowList
                    set winTitle to (name of w) as string
                    ignoring case
                        if winTitle starts with "notes" then
                            set notesWindowCount to notesWindowCount + 1
                            -- 若窗口被最小化则先还原
                            try
                                if (value of attribute "AXMinimized" of w) is true then
                                    set value of attribute "AXMinimized" of w to false
                                    delay 0.1
                                end if
                            end try
                            -- 先让进程到最前,再抬升具体窗口
                            set frontmost of proc to true
                            delay 0.05
                            try
                                perform action "AXRaise" of w
                            end try
                        end if
                    end ignoring
                end repeat
            end try
        end repeat
        
        if notesWindowCount is 0 then
            return "❌ 未找到标题包含 'notes' 的 VSCode 窗口"
        else
            return "✅ 已激活 " & notesWindowCount & " 个标题包含 'notes' 的 VSCode 窗口"
        end if
        
    on error errMsg
        return "❌ 脚本执行出错: " & errMsg
    end try
end tell

posted @ 2026-02-04 19:11  meetrice  阅读(10)  评论()    收藏  举报