Author Topic: rexx Screen Capture  (Read 13898 times)

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 275
  • Karma: +5/-0
    • View Profile
rexx Screen Capture
« 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

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 275
  • Karma: +5/-0
    • View Profile
Re: rexx Screen Capture
« Reply #1 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

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: rexx Screen Capture
« Reply #2 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.
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 275
  • Karma: +5/-0
    • View Profile
Re: rexx Screen Capture
« Reply #3 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

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: rexx Screen Capture
« Reply #4 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

Regards
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: rexx Screen Capture
« Reply #5 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
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 275
  • Karma: +5/-0
    • View Profile
Re: rexx Screen Capture
« Reply #6 on: December 07, 2013, 02:43:28 pm »
Hello,

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

  • Unpack the .zip-file somewhere, e.g. C:\Desktop\rxImgSize
  • Open a program or folder that contain the title text "rxImgSize" ¹ (e.g. Folder or Archive manager with .zip-file open) and another window that contain the text "Editor" ¹ (e.g. Text Editor).
  • Start a command prompt and run the script "rxtestimgsze"
    • C:\DESKTOP\rxImgSize                                     Show current directory
    • C:\DESKTOP\rxImgSize                                     Show current directory
    • [C:\DESKTOP\rxImgSize]MKDIR IMAGES           Create a subfolder named IMAGES
    • >rxImgSize: version 1.02, GBM: version 1.12<  Show version information about the library itself and GBM
    • >1.02<                                                                Show only information about the library itself
    • >1.12<                                                                Show only information about the GBM library
    • 0                                                                         Capture² window that contain the title text "rximgsize" and save as example0.bmp in the folder images
    • 338 243 24                                                         Show size and color depth for saved image (width height bpp)
    • 0                                                                         Resize example0.bmp to 100 pixels wide (keep aspect) and save the result as example1.jpg in the folder images
    • 0                                                                         Resize example0.bmp to 120 pixels wide (keep aspect) and save the result as example1.bmp in the folder images
    • 0                                                                         Resize example0.bmp to 120x120 pixels and save the result as example2.bmp in the folder images
    • 0                                                                         Resize example0.bmp to 120 pixels high and save the result as example3.bmp in the folder images
    • 0                                                                         Resize example3.bmp to 137 pixels high and replace example3.bmp in the folder images
    • 0                                                                         Read example0.bmp and save it as example4.bmp in the folder images
    • 0                                                                         Resize example4.bmp to 210 pixels wide and replace it
    • 0                                                                         Read and do quality scale (Lanczos) of example1.bmp to 1000x1000 pixels and save it as example5.bmp
    • 0                                                                         Read and do quality scale (Nearestneighbor) of example3.bmp to 2000x2000 pixels and save it as example6.bmp
    • 0                                                                         Read and do quality scale (Lanczos) of example0.bmp to 3000x3000 pixels and save it as example7.bmp
    • 0                                                                         Capture² the desktop and save as example.bmp in the folder images
    • 0                                                                         Capture² interior of window that contain the title text "editor" and save as example8.bmp in the folder images
    • [C:\DESKTOP\rxImgSize]

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
« Last Edit: December 11, 2013, 09:16:53 pm by Jan-Erik Lärka »

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 275
  • Karma: +5/-0
    • View Profile
New Version to Capture Images of the Screen with Rexx
« Reply #7 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
« Last Edit: May 19, 2014, 12:30:27 pm by Jan-Erik Lärka »

Martin Iturbide

  • OS2World NewsMaster
  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4710
  • Karma: +41/-1
  • Your Friend Wil Declares...
    • View Profile
    • Martin's Personal Blog
Re: rexx Screen Capture
« Reply #8 on: May 18, 2014, 03:41:18 pm »
Thanks Jan-Erik.

I'm uploading it to hobbes.
Martin Iturbide
OS2World NewsMaster
... just share the dream.

Jan-Erik Lärka

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 275
  • Karma: +5/-0
    • View Profile
Re: rexx Screen Capture
« Reply #9 on: May 18, 2014, 05:45:02 pm »
Hello,

was just reading how to do it .

Thank you for helping me out! :-)
« Last Edit: May 18, 2014, 05:46:39 pm by Jan-Erik Lärka »