我正在开发一个屏幕截图应用程序,我使用 NSTask 来截取屏幕截图,但是当应用程序截取屏幕截图 Mac OSX 默认屏幕截图声音将被播放。
let theProcess = NSTask()
theProcess.launchPath = "/usr/sbin/screencapture"
theProcess.arguments = ["/Users/profile/Desktop/111.png"]
theProcess.launch()
Run Code Online (Sandbox Code Playgroud)
如何仅针对当前任务禁用它,而通常不在 mac osx 中禁用它。
或者如果我能改变声音就好了。
将-x参数传递给命令:
theProcess.arguments = ["-x", "/Users/profile/Desktop/111.png"]
Run Code Online (Sandbox Code Playgroud)
运行screencapture --help.