Alfred使用AppleScript来实现一键隐藏功能(老板键)
03-28 发布 | 08-17 更新 | 浏览数 18
AI 摘要
Mac自动化脚本:隐藏指定进程,提升工作效率。快速隐藏WeChat、QQ等进程,提高生产力,点击了解详细教程!


更新: > 2024.04.15 如果某个进程不判断捕获异常,使得代码能够继续执行
set appNames to { "WeChat", "QQ"}
tell application "System Events"
repeat with appName in appNames
try
set appProcess to first process whose name is appName
set appId to id of appProcess
tell process appName
set visible to false
end tell
on error errMsg
-- Ignore error if process does not exist
end try
end repeat
end tell~~set appNames to {"WeChat","QQ"} -- 将要隐藏的进程名称放入数组中~~
~~tell application "System Events"~~ ~~repeat with appName in appNames~~ ~~set appProcess to first process whose name is appName~~ ~~set appId to id of appProcess~~ ~~tell process appName~~ ~~set visible to false~~ ~~end tell~~ ~~end repeat~~ ~~end tell~~
