苹果脚本--Automatically open the Messages chat window

本文提供了一种解决苹果消息应用未自动打开聊天窗口的方法,通过使用AppleScript自动化脚本,确保收到好友消息时,聊天窗口能立即显示,避免错过重要信息。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

Automatically open the Messages chat window 


I was annoyed by a behavior of Messages.app. When a friend sends me a message the chat window will not open automatically. Instead the Messages app icon will get a badge and bounce a couple of times in the dock. 

But if I'm not currently at the computer, and since I do not use the Dock to launch apps and I have the Dock always hidden, I could easily miss a message for a long time. So I came up with the following solution. 

First open /Utilities/AppleScript.app and paste the following into the script editor:

using terms from application "Messages"
	on message received theText from theBuddy for theChat
		set visible of window "Messages" to true
	end message received	
end using terms from
Pick a name and save the script in the scripts folder ~/Library/Scripts

Next open up /Applications/Messages.app and do the following:
  • Under Preferences select Alerts.
  • Under Event select Received Message.
  • Tap Run an AppleScript and select your previously saved script under the Pop-Up menu.
Now when you receive a new message while you are away from the computer you have an open window with the message waiting for you. 

[crarko adds: I haven't tested this one. You need to be running 10.8 or later to have the Messages application, of course.]

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值