Babu
Babu

Reputation: 442

How to capture screen from multiple monitor in ActionScript 3?

I want to capture screen in my second monitor, Currently i am using CmdCapture.exe application to take screenshot in certain time interval but it is only capturing the screen from primary monitor so i have no knowledge how to capture screen from secondary monitor using CmdCapture.exe.

I am using the following codes to take screenshot:

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++;

So anybody have an idea how to take screenshot from secondary monitor using CmdCapture.exe or using any other applications which can be run in actionscript nativeprocess command, please help me.

Upvotes: 0

Views: 251

Answers (1)

VC.One
VC.One

Reputation: 15881

Regarding BoxCutter docs...

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.

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

Where numbers for :
AA is starting origin along X-axis (left/right)
BB is starting origin along Y-axis (up/down)
CC is grab width along X-axis (left/right)
DD is grab height along Y-axis (up/down)

As an example let's test : Screen 1 is w=1280 & h=800, Screen 2 is w=1024 & h=768.

grabbing examples :

  • for monitor 1 only use: boxcutter -c 0,0,1280,800 testgrab.png

  • for monitor 2 only use: boxcutter -c 1280,0,2304,768 testgrab.png

  • for both monitors 1 & 2 together use: boxcutter -c 0,0,2304,800 testgrab.png

Note that Screen 2 begins after the width of Screen 1 ends. So to grab both screens at same time CC must be total of added widths of Screen 1 + Screen 2. For height DD must use biggest height (from one of those two screens) to avoid any unwanted cropping.

Try this in your code

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

where : myWidth & myHeight = required width & height of grab area. .

PS : Check this Article since it might help you with settings for multiple monitors...

Upvotes: 1

Related Questions