Macos 禁用NSTask屏幕截图声音
我正在开发一个屏幕截图应用程序,我使用NSTask截图,但当应用程序截图时,将播放Mac OSX默认屏幕声音Macos 禁用NSTask屏幕截图声音,macos,swift,cocoa,Macos,Swift,Cocoa,我正在开发一个屏幕截图应用程序,我使用NSTask截图,但当应用程序截图时,将播放Mac OSX默认屏幕声音 let theProcess = NSTask() theProcess.launchPath = "/usr/sbin/screencapture" theProcess.arguments = ["/Users/profile/Desktop/111.png"] theProcess.launch() 如何仅针对当前任务禁用它,而不是在mac osx中禁用它 或者,如果我能够更改声
let theProcess = NSTask()
theProcess.launchPath = "/usr/sbin/screencapture"
theProcess.arguments = ["/Users/profile/Desktop/111.png"]
theProcess.launch()
如何仅针对当前任务禁用它,而不是在mac osx中禁用它
或者,如果我能够更改声音,这也很好。将
-x
参数传递给命令:
theProcess.arguments = ["-x", "/Users/profile/Desktop/111.png"]
通过运行
screenscapture--help
将-x
参数传递给命令,可以获得更多选项:
theProcess.arguments = ["-x", "/Users/profile/Desktop/111.png"]
运行screenscapture--help
Wow,太好了:)非常感谢!非常感谢