Screen clipping

Post your working scripts, libraries and tools
User avatar
tank
Posts: 2183
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Louisville KY
Contact:

Re: Screen clipping

15 Nov 2017, 10:17

Note the image capture is off on secondary monitors I don't have time ATM to look into why
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
User avatar
Joe Glines
Posts: 481
Joined: 30 Sep 2013, 20:49
Facebook: https://www.facebook.com/theAutomatorGuru/
Google: https://plus.google.com/105328929654286634910
GitHub: joetazz
Location: Dallas
Contact:

Re: Screen clipping

18 Nov 2017, 13:12

@Tank- Thanks! While I used to have the mindset that I'll use other tools, the more I do with AutoHotkey, the better I can tailor what I want to do to MY needs! Thus I've given up on a ton of other tools as I've incorporated their service into AutoHotkey. :)
need4speed
Posts: 38
Joined: 22 Apr 2016, 06:50

Re: Screen clipping

20 Nov 2017, 19:12

tank wrote:Note the image capture is off on secondary monitors I don't have time ATM to look into why

as this script seems to be quite popular (I use it myself daily) whenever you (or someone else reading this) find the time maybe you'd like to:
- clean up the code to make it easier to modify
- fix tanks (potential) bug regarding the second screen
- fix my (potential) bug regarding the frame when saving
- add an option to allow/toggle click through (could be handy sometimes)
- display active/focused screenshot with a red frame (helps to prevent closing the wrong window)
- add an option to change transparency (see my post)

so how could the last feature be of any use? imagine you'd like to quickly compare 2 drawings (or whatsoever).
to do so take screenshots then make one semi-transparent and move it over the first. done.
probably there are more things which could be added/fixed without braking the great luser experience.
in case you're wondering why I am not doing all of that and more myself, consult my postings in the help section as a hint. :beer:
User avatar
Joe Glines
Posts: 481
Joined: 30 Sep 2013, 20:49
Facebook: https://www.facebook.com/theAutomatorGuru/
Google: https://plus.google.com/105328929654286634910
GitHub: joetazz
Location: Dallas
Contact:

Re: Screen clipping

21 Nov 2017, 14:37

@Tank- I've been using this for years and have never seen an issue with second monitor.
@need4speed- Please help yourself! I like the script the way it is and don't have time / care to implement the other changes. That's the point of me posting the source code! Knock yerself out! :)
User avatar
tank
Posts: 2183
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Louisville KY
Contact:

Re: Screen clipping

21 Nov 2017, 14:57

Well it captures down and to the left of what i drag the rectangle around for me
Win 10
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
User avatar
Joe Glines
Posts: 481
Joined: 30 Sep 2013, 20:49
Facebook: https://www.facebook.com/theAutomatorGuru/
Google: https://plus.google.com/105328929654286634910
GitHub: joetazz
Location: Dallas
Contact:

Re: Screen clipping

21 Nov 2017, 15:04

@Tank- Very odd! That sounds like what it used to do until rommmcek to fixed the DPIScale issue in this post: https://autohotkey.com/boards/viewtopic ... 20#p114118

Does your script have

Code: [Select all] [Download] GeSHi © Codebox Plus

Gui %g%: +AlwaysOnTop -caption +Border +ToolWindow +LastFound -DPIScale
User avatar
tank
Posts: 2183
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Louisville KY
Contact:

Re: Screen clipping

21 Nov 2017, 15:39

Nope
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
User avatar
tank
Posts: 2183
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Louisville KY
Contact:

Re: Screen clipping

21 Nov 2017, 15:41

Still does it however
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
User avatar
Sabestian Caine
Posts: 204
Joined: 12 Apr 2015, 03:53

Re: Screen clipping

24 Nov 2017, 04:42

Joe Glines wrote:A few years ago I made tweaks to your (and other's) screen clipping script. Just thought I'd post it here as I use this functionality at least a dozen times a day and I think more people should consider it as an always-running script.

The gist of the tweaks I made are:
1) Windows+Control and left-mouse-click (drawing a rectangle) will do normal clipping and leave clipboard empty

2) Windows+Alt and left-mouse-click (drawing a rectangle) saves the image as jpg and bmp in the folder where script is running, then creates an email in Outlook adding in info about the picture (time it was taken, etc) and copies the path to the jpg to the clipboard (this is convenient if posting to Facebook)

3) Windows+left-mouse-click(drawing a rectangle) will do normal clipping but copies it to the clipboard as well.

For those that do not use screen-clipping regularly, I've made a short video demonstrating how I use it. Trust me- Once you start using it, you'll wonder how you worked without it. :superhappy:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus




Hello dear Joe Glines........
first i thank you for such useful script.... You really worked great for screen clipping.....

sir, one thing i want, if you could plz help me...
As we can clip any area of screen by mouse drag using your codes but sir i want to clip the fixed area of screen when i press specific hotkey....
for example if we want to clip the active screen's specific region then by simply dragging mouse on that specific region we can clip that part...
but suppose if that specific region falls under 237, 207, 683, 400 coordinates and i have to clip that region again and again then i have to drag mouse again and again....
so sir please provide me modified codes to clip the fixed region, in which i can simply put the x and y coordinates of the fixed area which i want to clip and i can simply clip that area by assigning the codes any hotkey. please help me. I will be highly obliged to you. thanks a lot....
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
rommmcek
Posts: 297
Joined: 15 Aug 2014, 15:18

Re: Screen clipping

07 Dec 2017, 09:30

@Tank: Sounds like you have different resolution on second monitor or probably vertical orientation (portrait).
Solution would be to scale the coordinates for capturing, adding x*=round(x*secondMonWidth/firstMonWidth), y*=round(y*secondMonHight/firstMonHight) before penultimate block/paragraph of the function: Gdip_BitmapFromScreen(Screen=0, Raster="")If my supposition is right, this would cause then capture image up to the right on first monitor! (or analogous, I might have mixed up scaling factors).
If so, next step would be automate scaling.
Last edited by rommmcek on 07 Dec 2017, 11:22, edited 1 time in total.
rommmcek
Posts: 297
Joined: 15 Aug 2014, 15:18

Re: Screen clipping

07 Dec 2017, 11:11

Adding x*=2, y*=2, w*=2, h*=2 on the same spot would yield correct capture of the screen, providing Windows Magnifier is set to 100% and upper left corner of the screen has 0, 0 coordinate values!

Edit: Removed redundant scaling of hbm
Last edited by rommmcek on 09 Dec 2017, 01:07, edited 1 time in total.
rommmcek
Posts: 297
Joined: 15 Aug 2014, 15:18

Re: Screen clipping

07 Dec 2017, 11:45

@Sabestian Caine: Adding on the same spot x:=237, y:=207, w:=683, h:=400 and v1:=237, v2:=207 after StringSplit, v, Area, | would capture desired block no matter what you've chosen!
P.s.: You've been lucky, all things are related!
P.p.s.: If you want trigger capturing with HotKey w/o dragging a mouse (e.g. F2::) then you have to comment two lines after added v1:=237, v2:=207 out!
User avatar
Sabestian Caine
Posts: 204
Joined: 12 Apr 2015, 03:53

Re: Screen clipping

07 Dec 2017, 12:11

rommmcek wrote:@Sabestian Caine: Adding on the same spot x:=237, y:=207, w:=683, h:=400 and v1:=237, v2:=207 after StringSplit, v, Area, | would capture desired block no matter what you've chosen!
P.s.: You've been lucky, all things are related!
P.s.: If you want trigger capturing with HotKey w/o dragging a mouse (e.g. F2::) then you have to comment two lines after added v1:=237, v2:=207 out!


Thanks dear rommmcek for your kind reply...
but sir the codes are not capturing the desired rectangle from the screen even after adding x:=237, y:=207, w:=683, h:=400 and v1:=237, v2:=207 after StringSplit, v, Area, |

However after adding the above codes into the script, when i drag the mouse holding down window and control button then the selected area are shown on x:=237, y:=207.. but i want that the the coordinates of upper left corner and bottom right corner of the rectangle, should be provided by me into the script and it should crop only that area of screen. please help me to do that. thanks a lot...
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
rommmcek
Posts: 297
Joined: 15 Aug 2014, 15:18

Re: Screen clipping

07 Dec 2017, 13:04

I wasn't clear enough and you didn't read attentive enough!
P.s.: Press F2 or drag with a mouse what ever while pressing Win!
Attachments
ScreenClipping_block.rar
(19.75 KiB) Downloaded 6 times
User avatar
Sabestian Caine
Posts: 204
Joined: 12 Apr 2015, 03:53

Re: Screen clipping

08 Dec 2017, 00:04

rommmcek wrote:I wasn't clear enough and you didn't read attentive enough!
P.s.: Press F2 or drag with a mouse what ever while pressing Win!


Thank you so much dear rommmcek.... this is the really what i want.... so nice of you....
please tell me one more thing- as i want to clip the area- x30 y192 (upper left corner) and x806 y275 (bottom right corner)
and i want it should show at coordinates x0 y0
then how can i insert these values into the codes?
I am unable to insert these values into the script to crop my desired portion of screen and to show the clip at the desired region of screen. please help me. when i press f2 button then it shows some default clip ractangle on screen. thanks a lot sir....
I don't normally code as I don't code normally.
YOU do what YOU want, but happens what HE wants.
YOU do what HE wants, will happen what YOU want.
rommmcek
Posts: 297
Joined: 15 Aug 2014, 15:18

Re: Screen clipping

08 Dec 2017, 00:52

Just play with these two lines:
- v1:=237, v2:=207 (where to show)
- x:=237, y:=207, w:=683, h:=400 (what to capture)
P.s.: Please remove this: sx:=sx*2, sy:=sy*2 (just this, curly bracket remains!). This was blunder of mine!
User avatar
tank
Posts: 2183
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Louisville KY
Contact:

Re: Screen clipping

08 Dec 2017, 06:32

rommmcek wrote:Sounds like you have different resolutio
yep
rommmcek wrote:before penultimate block/paragraph
I dont think i understand
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
rommmcek
Posts: 297
Joined: 15 Aug 2014, 15:18

Re: Screen clipping

08 Dec 2017, 08:06

Excuse me for being so imprecise! This is the function to be edited:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Now please manually insert values for first & second Monitor (Width and Hight) in pixels.
User avatar
tank
Posts: 2183
Joined: 28 Sep 2013, 22:15
Facebook: charlie.simmons.7334
Google: ttnnkkrr
GitHub: ttnnkkrr
Location: Louisville KY
Contact:

Re: Screen clipping

08 Dec 2017, 09:17

@rommmcek thanks for the clarification. I tried it and it captures the upper right corner of my first monitor. That isn't what I need at all. At some point during Xmas week, i may get bored and attempt to figure this out unless something gets suggested that works to capture the image under the gui correctly
We are troubled on every side‚ yet not distressed; we are perplexed‚
but not in despair; Persecuted‚ but not forsaken; cast down‚ but not destroyed;
https://www.facebook.com/ahkscript.org
If you have forum suggestions please submit a pull request
rommmcek
Posts: 297
Joined: 15 Aug 2014, 15:18

Re: Screen clipping

08 Dec 2017, 10:01

Don't give up so easily! On your place I would try this: x+=100, y-=100 to displace capturing for 100 pixels to the right and upwards.
In a few iteration you can reach the right place!

Besides consider this: ratio secondMonWidth/firstMonWidth must be greater then 1
and ratio secondMonHight/firstMonHight obiously must be lesser then 1

otherwise you should take reciprocal values!

Return to “Scripts and Functions”

Who is online

Users browsing this forum: Joe Glines and 22 guests