Screen clipping

Post your working scripts, libraries and tools for AHK v1.1 and older
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Screen clipping

19 Jan 2016, 08:32

Look under applications then select the Client ID
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
TheBrohman
Posts: 13
Joined: 07 Dec 2015, 12:31

Re: Screen clipping

19 Jan 2016, 09:22

Allright, thanks I got it. But it is not working. https://youtu.be/FawNbKpdDBU
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Screen clipping

19 Jan 2016, 14:17

troubleshooting remotely is pretty tough... Here are a few quick take-aways
1) the IMUGR part didn't work because there was no file to upload
2) although you said "nothing" which doing some of the hotkeys, you do see the rectangle being made when you drag which is a good sign that somethiig is working
3) I'd put some message boxes in there to see if an object is getting created (or at least to confirm where you get to in the script)
4) the way the script works you should see a capture immediately after holding down the windows key and dragging. (thus your opening paint/editor and pasting will not work) It boils down to an error why the file/image isn't getting created in the first place
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
JJohnston2
Posts: 204
Joined: 24 Jun 2015, 23:38

Re: Screen clipping

14 Feb 2016, 19:50

This is a really great script... thank you for posting :bravo:

I had a few troubles getting it to work but that was due to my setup and here is what I had to update...
  • First update I had to make before anything would work was using the latest GDIP routines... I'm wondering if that was an x64 compatibility issue.
  • After that I had a secondary issue, because in SCW_SelectAreaMod() there is a while loop that waits for the mouse button to no longer be pressed, i.e., user is done drawing the box... While, (GetKeyState(Hotkey, "p")). It turns out that I had an old copy of polyethylene's functions.ahk #included which had a duplicate/deprecated GetKeyState() function... getting that nuked finally got it running.
I also added the escape option to close before I saw it noted in previous posts here on this thread... I tried options for closing both the active window or all windows, not sure which option I'll keep, but maybe just the individual window option for now since it's easy enough to click through them and close individually.

I have been itching to have this running ever since I saw the YouTube video (which was also great btw--if it weren't for that I would have ignored the code because it didn't run for me out of the box).

Something I am currently working on (which is partially working) is to slave this to the OneNote screen capture utility. There is a key difference between the OneNote utility and this tool, which is the order of capture. The OneNote utility will capture the whole screen and then make it available to crop. This means you can grab things instantaneously that popup and disappear, including windows that might disappear if they lose focus, or things like that. With this screen clipper utility, it will only capture after you're done drawing the box, and ongoing activity will continue to update the screen underneath it. BUT, this one will keep the graphics on the screen and can be customized to save, attach to an email, etc. So I'm hoping to get the best of both worlds eventually.

Nice work... this is really great :thumbup:
JJohnston2
Posts: 204
Joined: 24 Jun 2015, 23:38

Re: Screen clipping

14 Feb 2016, 21:32

Another thing I forgot about that was not working... the part that copies the screen to the clipboard without the border:

Code: Select all

SCW_Win2Clipboard(KeepBorders=0) {
   Send, !{PrintScreen} ; Active Win's client area to Clipboard
   if !KeepBorders
   {
      pToken := Gdip_Startup()
      pBitmap := Gdip_CreateBitmapFromClipboard()
      Gdip_GetDimensions(pBitmap, w, h)
      pBitmap2 := SCW_CropImage(pBitmap, 3, 3, w-6, h-6)
      Gdip_SetBitmapToClipboard(pBitmap2)
      Gdip_DisposeImage(pBitmap), Gdip_DisposeImage(pBitmap2)
      Gdip_Shutdown("pToken")
   }
}
Two things about this:
  • First, possibly because I am using a different version of GDIP and/or x64 issues, it just doesn't work for me... not sure how to go about tackling that one yet
  • Second, I'm pretty sure "pToken" should be passed as an argument, not in quotes, i.e., Gdip_Shutdown("pToken") should be Gdip_Shutdown(pToken)... that looks like a typo in the original code as far as I can tell that would mostly go unnoticed unless you're looking at the memory profile, where various pToken objects are accumulating over time and not actually being released
rickss
Posts: 3
Joined: 14 Jul 2016, 08:00

Help to make it work

14 Jul 2016, 08:06

Hi, this is a really great script, but I didn't get it to work!
01. When I press "Win + Left Button" and drag I see the rectangle being made, but when I release the "Left Button" nothing happens!

I am running the latest version of AHK, with Windows10 x64.
Please, help me.
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Screen clipping

14 Jul 2016, 08:42

Can you confirm the script is actually running? Also you might throw in a messagebox right after the call to the hotkey to see if your hotkey is actually triggering anything
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
rickss
Posts: 3
Joined: 14 Jul 2016, 08:00

Re: Screen clipping

14 Jul 2016, 09:08

Yes, the script is running. I checked with a messagebox.

Btw, I've got it to work with the "Gdip All" (for other versions of AHK: 32, 64, unicode, ansi)
#Include %A_ScriptDir%\Gdip_All.ahk
This way the script seems to work properly.
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Screen clipping

14 Jul 2016, 09:45

There should be no need to include it because I went through and extracted everything needed and included it in my file. Having said that, I wonder why it works when you do that. Can you send me the script you're running so I can review? [email protected]
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
rickss
Posts: 3
Joined: 14 Jul 2016, 08:00

Re: Screen clipping

14 Jul 2016, 09:52

I've just send it
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Screen clipping

15 Jul 2016, 12:17

Just in case y'all have had the same issue as rickss, we figured out the issue. He's normally running the 64-bit version of AutoHotkey and thus caused the issue. I've updated the original code to detect what version it is running under and revert to 32 bit if it is launched in 64 bit code. (maestrith helped with that one)
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
DeepMind
Posts: 271
Joined: 19 Jul 2016, 14:47

Re: Screen clipping

01 Aug 2016, 04:57

This is awesome, thanks you for sharing man
User avatar
BGM
Posts: 507
Joined: 20 Nov 2013, 20:56
Contact:

Re: Screen clipping

01 Aug 2016, 22:26

Mr. Glines - I have been using this script now for awhile and I absolutely love it! I use it on my desktop all the time and even put it on my laptop.

So useful! I use win+drag to create the screen-snip and use it as reference.

Thank you so much for this!

Someone is copycatting your idea, though!
Look: http://www.snapfiles.com/get/snipaste.html
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Screen clipping

02 Aug 2016, 06:21

DeepMind & BGM- I'm glad y'all find it helpful! I sure do as it is one of the scripts I use most often.

yes, there are a lot of "snipping" tools out there. I used the original one of this for quite awhile but added in the extra functionality which, for me, is what really makes it useful. :)
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
User avatar
joshebosh
Posts: 6
Joined: 23 May 2016, 19:15

Re: Screen clipping

03 Aug 2016, 17:04

Hey Joe,

For what it's worth, I'm on Windows 10, 64bit, and the snipping did not work out of the box...
I noticed you had Gdip v1.38 in your script...
I replaced it with Gdip v1.45 and now things are working as I see in your youtube videos...

Thanks for all your effort! This is definitely cool stuff!!!
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Screen clipping

03 Aug 2016, 18:24

Yeah- I use 32-bit of AutoHotkey. I added the below code which will relaunch the script if the current version is 64 bit but hadn't updated the original code yet.

Code: Select all

if((A_PtrSize=8&&A_IsCompiled="")||!A_IsUnicode){ ;32 bit=4  ;64 bit=8
    SplitPath,A_AhkPath,,dir
    if(!FileExist(correct:=dir "\AutoHotkeyU32.exe")){
	    MsgBox error
	    ExitApp
    }
    Run,"%correct%" "%A_ScriptName%",%A_ScriptDir%
    ExitApp
    return
}
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!
redtwo
Posts: 5
Joined: 30 May 2014, 11:22

Re: Screen clipping

17 Oct 2016, 17:31

Hi. I love this script. However, I have to use a 125% zoom to text, apps, etc in Windows 10. It is the only way I can read the screen without killing my eyes. Because of this, the end of the rectangle is off with my mouse. I know I need a scaling factor but I don't know enough to know where to put it. Any suggestions?

H
User avatar
rommmcek
Posts: 1470
Joined: 15 Aug 2014, 15:18

Re: Screen clipping

22 Oct 2016, 15:43

Try to finde Gui %g%: +AlwaysOnTop -caption +Border +ToolWindow +LastFound and convert to Gui %g%: +AlwaysOnTop -caption +Border +ToolWindow +LastFound -DPIScale
paik1002
Posts: 355
Joined: 28 Nov 2015, 02:45

Re: Screen clipping

22 Oct 2016, 23:01

Unlike other people here, I am having trouble getting it running it to do what it claims, on my system(64-bit Windows 10).

Lwin+Lbutton+drag mouse brings up the yellow highlighted box alright.
However, nothing happens after that(releasing the mouse button should result in a final capture).
No screen capture, therefore no floating window.
The other hotkeys(i.e. e-mail & URL extensions) produce runtime errors staring at line 2508: imag.LoadFile(File_to_Upload).

I tested it in two different ways:
(1) Incorporating it into my existing script via "#Include %A_ScriptDir%\screenclip.ahk" where screenclip.ahk is the screen clipping script(full update version),
(2) Compiling and independently running it(without other AHK scipts running together).

Both non-compiled/compiled versions show similar symptoms, and both fail to work.
Suspecting version imcompatibility, I also tried setting the compatiblity mode to Windows 7 , but to no avail.

Help would be appreciated.
User avatar
Joe Glines
Posts: 770
Joined: 30 Sep 2013, 20:49
Location: Dallas
Contact:

Re: Screen clipping

23 Oct 2016, 20:18

Sorry I didn't see your post. The original post didn't work for 64 bit. I've updated it to detect if you're running 64 bit. If you are, it will switch to 32 bit version of AutoHotkey. that's what the following code is doing:

Code: Select all

if((A_PtrSize=8&&A_IsCompiled="")||!A_IsUnicode){ ;32 bit=4  ;64 bit=8
    SplitPath,A_AhkPath,,dir
    if(!FileExist(correct:=dir "\AutoHotkeyU32.exe")){
	    MsgBox error
	    ExitApp
    }
    Run,"%correct%" "%A_ScriptName%",%A_ScriptDir%
    ExitApp
    return
}
Sign-up for the 🅰️HK Newsletter

ImageImageImageImage:clap:
AHK Tutorials:Web Scraping | | Webservice APIs | AHK and Excel | Chrome | RegEx | Functions
Training: AHK Webinars Courses on AutoHotkey :ugeek:
YouTube

:thumbup: Quick Access Popup, the powerful Windows folders, apps and documents launcher!

Return to “Scripts and Functions (v1)”

Who is online

Users browsing this forum: MiM and 134 guests