OS2 World Community Forum

OS/2, eCS & ArcaOS - Technical => Programming => Topic started by: Jan-Erik Lärka on December 01, 2013, 06:20:57 pm

Title: rexx Screen Capture
Post by: Jan-Erik Lärka on December 01, 2013, 06:20:57 pm
Hello,

I've managed to write a function in a rexx dll that can capture the screen and save it to a file.

I can post the source code and file here, but would first get your help how to find out the names of open windows (folders, applications etc.) to add that option as well.

Selection of screen coordinates would be nice as well, but I'll await your code before I post the .dll.

Regards,
//Jan-Erik
Title: Re: rexx Screen Capture
Post by: Jan-Erik Lärka on December 03, 2013, 07:36:31 pm
Hello,

see the attached .zip-file that contain both a rexx .dll debugger application, the rexx .dll for image manipulation, sources and scripts.

Please do read the source code to find more options and use a recent version of GBM to get support for more file types and quality scaling methods.

The software is provided "AS IS" and you're responsible to understand it's use, what it is intended for and you must take appropriate actions before usage to ensure it doesn't cause harm, problems etc.

//Jan-Erik
Title: Re: rexx Screen Capture
Post by: Martin Iturbide on December 05, 2013, 12:47:43 pm
Thanks Jan-Erik

Can you write a little readme for the files, something short, or write it just here and I will put it there.

Can we put a liberal license to it like the BSD 3-Clause license? It is very liberal and allows derivative works in several ways.

Quote
Copyright (c) 2013, Jan-Erik Lärka
All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of "Jan-Erik Lärka" nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Title: Re: rexx Screen Capture
Post by: Jan-Erik Lärka on December 05, 2013, 07:18:27 pm
Hello,

that would be very nice to add, feel free Martin to do so and repack the .zip-file, but please note that parts of the code has been influenced by GBM (Thanks to the work by Heiko Nitzsche, Germany ).

The string-number-whatever C++ class "var" is my own work that begun during the school days and help me simplify usage to write libraries in C/C++ for rexx.

Btw, anyone found it useful?
Know how to add on-screen-selection-support?

//Jan-Erik
Title: Re: rexx Screen Capture
Post by: Martin Iturbide on December 06, 2013, 02:56:30 pm
Hi.

Let me know what do you think, I'm attaching the file with a basic readme and license file.

I also created a Wiki page which you are free to change/improve:
http://www.os2world.com/wiki/index.php/RxImgSize (http://www.os2world.com/wiki/index.php/RxImgSize)

Regards
Title: Re: rexx Screen Capture
Post by: Martin Iturbide on December 06, 2013, 03:23:09 pm
I'm not a REXX expert (non-expert in a lot of things :D) but on my side the example is working fine.

The example generated 2 .bmp files, one with the screenshot of the desktop and other with some kind of log.

It is an interesting library for developers. Thanks

Regards
Title: Re: rexx Screen Capture
Post by: Jan-Erik Lärka on December 07, 2013, 02:43:28 pm
Hello,

for those of you that would like to get a hint...


You should see several rows with 0 (zero) if it is successful ³.
The capture procedure search for window names that match exactly (though caseless comparison) at first, but if it can't find any match look for windows that contain the text.


¹) or "RXIMGSIZE" or "rximgsize" or any variation to it as capitalization doesn't matter
²) the capture procedure will return "RXIMGSIZE not found." if there is no window with that name
³) info/resize/scale etc. will fail with a number depending on the cause. 0 = OK, 2 = missing image/file, etc. See source code for specific reasons.

//Jan-Erik
Title: New Version to Capture Images of the Screen with Rexx
Post by: Jan-Erik Lärka on May 17, 2014, 11:47:08 pm
Hello,

I've completed the rewrite of the library ( RxImgSze 1.03 ) to capture the screen and/or parts of it and save as an image (jpg, png, bmp etc.).
The library can also scale images and reduce/increase the number of colors of images of various file formats (jpg, png, gif, bmp etc.).
See the included hlp-file for information how to use the rexx library.
____
The script html2hlp interpret a html file to create a help file. ( Basic HTML 3.2 and HTML 4.0 )
See the example HTML file and "readme"
____
The included debug application help you debug libraries (.dll) for rexx
See "readme" for information

//Jan-Erik

Documentation corrected May 18, 2014, 10:10 CET
Title: Re: rexx Screen Capture
Post by: Martin Iturbide on May 18, 2014, 03:41:18 pm
Thanks Jan-Erik.

I'm uploading it to hobbes.
Title: Re: rexx Screen Capture
Post by: Jan-Erik Lärka on May 18, 2014, 05:45:02 pm
Hello,

was just reading how to do it .

Thank you for helping me out! :-)