如何在 Mac OSX Lion 中创建菜单栏切换?
我将如何创建一个菜单栏图标来切换麦克风静音按钮?
我会使用 AppleScript 还是 Objective-C?我应该在 Xcode 中创建什么样的项目(如果那是我应该使用的 IDE)。感谢您的任何帮助或指导。
How would I go about creating a menu bar icon to toggle the microphone mute button?
Would I use AppleScript or Objective-C? What kind of project do I create in Xcode (if that's the IDE I should use). Thanks for any help or direction.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
试试这个...
将其保存为本地
Library
文件夹的Scripts
文件夹中的常规脚本文件。如果菜单栏中有一个看起来像卷轴的小图标(以前称为“脚本菜单”),则脚本应该出现在该菜单中的某个位置。如果您没有看到该图标,请运行
AppleScript Utility
(位于/Applications/AppleScript/AppleScript Utility
)并选中在菜单栏中显示脚本菜单< /代码> 复选框。
现在,运行它所需要做的就是打开脚本菜单,找到您的脚本,然后单击它一次。问题?问。 :)
Try this...
Save this as a regular script file in the
Scripts
folder of the localLibrary
folder.If you have a little icon in your menubar that looks like a scroll (formerly known as the
Script Menu
), the script should appear somewhere in that menu. If you don't see the icon, runAppleScript Utility
(located at/Applications/AppleScript/AppleScript Utility
) and check theShow Script Menu in menu bar
checkbox.Now, all you have to do to run it is open up the Script Menu, find your script, and just click on it once. Questions? Ask. :)
这是一个简单的方法,因为我们可以直接获取或设置音量的输出静音属性...
至于设置菜单栏切换,请按照 fireshadow52 建议进行。从 AppleScript 编辑器的首选项中启用 applescript 菜单,然后将此 applescript 放入 ~/Library/Scripts 文件夹中(如果该文件夹不存在,则创建该文件夹)。
编辑:抱歉,我看到您希望麦克风静音而不是音量!我的错误。
Here's a simple way because we can get or set the output muted property of the volume directly...
As far as setting a menubar toggle, do as fireshadow52 suggested. Enable the applescript menu from the preferences in AppleScript Editor then place this applescript in the ~/Library/Scripts folder (create the folder if it doesn't exist).
EDIT: Sorry, I see you want the microphone muted not the volume! My mistake.