如何在 ActionScript 3 中从多个监视器捕获屏幕?

How to capture screen from multiple monitor in ActionScript 3?

我想在我的第二台显示器上截屏,目前我正在使用 CmdCapture.exe 应用程序在特定时间间隔截屏,但它只能从主显示器截屏,所以我不知道如何截屏使用 CmdCapture.exe.

从辅助监视器屏幕

我正在使用以下代码进行截图:

var cmdScreenCaputeLocation:File = File.applicationDirectory.resolvePath("assets\CmdCapture.exe");
var nativeProcessStartInfo:NativeProcessStartupInfo = new NativeProcessStartupInfo();
nativeProcessStartInfo.executable = cmdScreenCaputeLocation;

var args: Vector.<String> = new Vector.<String>();
var uid:String = "tempImg"+imgCounter+"";
args.push("/f", (uid+".jpg"),"/d",""+screencaptureDir+"", "/q 70");
nativeProcessStartInfo.arguments = args;
var nativeProcess:NativeProcess = new NativeProcess();
nativeProcess.addEventListener(NativeProcessExitEvent.EXIT,screenCaptureNativeProcessComplated);
nativeProcess.addEventListener(ProgressEvent.STANDARD_ERROR_DATA,screenCapturOonErrorS);
nativeProcess.addEventListener(IOErrorEvent.STANDARD_INPUT_IO_ERROR,screenCaptureOnError);
nativeProcess.start(nativeProcessStartInfo);
imgCounter++;

所以任何人都知道如何使用 CmdCapture.exe 或使用可以在 actionscript nativeprocess 命令中 运行 的任何其他应用程序从辅助监视器截取屏幕截图,请帮助我。

关于 BoxCutter 文档...

Usage : boxcutter [OPTIONS] [OUTPUT_FILENAME]

OPTIONS
-c, = coords X1,Y1,X2,Y2 capture the rectangle (X1,Y1)-(X2,Y2).
-f, = fullscreen capture the full screen.
-h, = help display help message.

用法 : boxcutter -c -AA,BB,CC,DD testgrab.png

其中数字为:
AA 是沿 X 轴的起始原点 (left/right)
BB 是沿 Y 轴的起始原点 (up/down)
CC 是沿 X 轴的抓取宽度 (left/right)
DD 是沿 Y 轴的抓取高度 (up/down)

举个例子让我们测试一下:屏幕 1 是 w=1280 & h=800,屏幕 2 是 w=1024 & h =768。

抓取例子 :

  • for monitor 1 仅使用:boxcutter -c 0,0,1280,800 testgrab.png

  • for monitor 2 仅使用:boxcutter -c 1280,0,2304,768 testgrab.png

  • for both monitors 1 & 2 一起使用:boxcutter -c 0,0,2304,800 testgrab.png

请注意,屏幕 2屏幕 1 的宽度结束后开始。所以要同时抓取两个屏幕 CC 必须是 Screen 1 + Screen 2 的总宽度。对于高度 DD 必须使用最大高度(来自这两个屏幕之一)以避免任何不需要的裁剪。

在您的代码中试试这个

args.push("-c");
args.push("0", "0", "myWidth", "myHeight");
args.push("testgrab.png");

其中:myWidth & myHeight = 抓取区域所需的宽度和高度。 .

PS :检查此 Article 因为它可能会帮助您设置多个显示器...