Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Macos 禁用NSTask屏幕截图声音_Macos_Swift_Cocoa - Fatal编程技术网

Macos 禁用NSTask屏幕截图声音

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中禁用它 或者,如果我能够更改声

我正在开发一个屏幕截图应用程序,我使用NSTask截图,但当应用程序截图时,将播放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,太好了:)非常感谢!非常感谢