Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Screen Capture with Transparent Windows and Mouse Cursor


  • Please log in to reply
245 replies to this topic
dangerdogL2121
  • Members
  • 636 posts
  • Last active: Nov 19 2015 03:39 AM
  • Joined: 22 Dec 2012

@Datalife

Great work!  I need to find a way to convert all the images to a video somehow.

The link https://ahknet.autoh...reenCapture.zip is the one not working not the one you specified.

thanks again


There is a new AutoHotkey forum here.


gregster
  • Members
  • 283 posts
  • Last active: Nov 09 2015 03:08 AM
  • Joined: 19 Mar 2009
The link https://ahknet.autoh...reenCapture.zip is the one not working not the one you specified.

I assume, ScreenCapture.ahk from the broken links page (http://www.autohotke...ated-5-22-2013/) should be the one you are looking for... (but these functions by Sean are already included in Datalife's example anyway)



dangerdogL2121
  • Members
  • 636 posts
  • Last active: Nov 19 2015 03:39 AM
  • Joined: 22 Dec 2012

Its finished!

http://pastebin.com/FHaKdDQ3

Please look at the comments in the beginning of the code.

thanks


There is a new AutoHotkey forum here.


DataLife
  • Members
  • 1022 posts
  • Last active: Nov 27 2015 01:09 AM
  • Joined: 27 Apr 2008

thanks.
I'm having trouble with adjusting DataLife's code.

 

My version

http://pastebin.com/FHaKdDQ3

 

I don't know where the problem is.  If you aren't having a problem with the program then I must have something messed up on my computer.

thanks

You forgot your braces

 

Your code

loop 50000
CaptureScreen(,,A_Desktop "\ScreenPictures\ScreenCapture" a_index ".jpg")
FileSetAttrib,-H,%A_Desktop%\ScreenPictures\ScreenCapture%a_index%.jpg
return

Code with braces

loop 50000
 {
  CaptureScreen(,,A_Desktop "\ScreenPictures\ScreenCapture" a_index ".jpg")
  FileSetAttrib,-H,%A_Desktop%\ScreenPictures\ScreenCapture%a_index%.jpg
 }
return

Check out my scripts.  (MyIpChanger) (XPSnap) (SavePictureAs) All my scripts are tested on Windows 7, AutoHotkey 32 bit Ansi unless otherwise stated.

dangerdogL2121
  • Members
  • 636 posts
  • Last active: Nov 19 2015 03:39 AM
  • Joined: 22 Dec 2012

Of course!

Many thankswink.png


There is a new AutoHotkey forum here.


dangerdogL2121
  • Members
  • 636 posts
  • Last active: Nov 19 2015 03:39 AM
  • Joined: 22 Dec 2012

Is there an easy way to get the mouse to be shown in the pictures?  I'm still using datalife's code.

Here's a script I cooked up.

http://pastebin.com/m5dNPTSm

Go to http://en.cze.cz/Images-to-video to find the imagestovideo program.  Put the main folder in the script's directory.

thanks


There is a new AutoHotkey forum here.


DataLife
  • Members
  • 1022 posts
  • Last active: Nov 27 2015 01:09 AM
  • Joined: 27 Apr 2008

Is there an easy way to get the mouse to be shown in the pictures?  I'm still using datalife's code.
Here's a script I cooked up.
http://pastebin.com/m5dNPTSm
Go to http://en.cze.cz/Images-to-video to find the imagestovideo program.  Put the main folder in the script's directory.
thanks

Put True as the 2nd parameter.
 
CaptureScreen(,True,A_Desktop "\ScreenPictures\ScreenCapture" a_index ".jpg")

Edit: I should have included the options. Here they are....

CaptureScreen(aRect, bCursor, sFileTo, nQuality)
1) If the optional parameter bCursor is True, captures the cursor too.
2) If the optional parameter sFileTo is 0, set the image to Clipboard.
If it is omitted or "", saves to screen.bmp in the script folder,
otherwise to sFileTo which can be BMP/JPG/PNG/GIF/TIF.
3) The optional parameter nQuality is applicable only when sFileTo is JPG. Set it to the desired quality level of the resulting JPG, an integer between 0 - 100.
4) If aRect is 0/1/2/3, captures the entire desktop/active window/active client area/active monitor.
5) aRect can be comma delimited sequence of coordinates, e.g., "Left, Top, Right, Bottom" or "Left, Top, Right, Bottom, Width_Zoomed, Height_Zoomed".
In this case, only that portion of the rectangle will be captured. Additionally, in the latter case, zoomed to the new width/height, Width_Zoomed/Height_Zoomed.

Example:
CaptureScreen(0)
CaptureScreen(1)
CaptureScreen(2)
CaptureScreen(3)
CaptureScreen("100, 100, 200, 200")
CaptureScreen("100, 100, 200, 200, 400, 400") ; Zoomed


Convert(sFileFr, sFileTo, nQuality)
Convert("C:\image.bmp", "C:\image.jpg")
Convert("C:\image.bmp", "C:\image.jpg", 95)
Convert(0, "C:\clip.png") ; Save the bitmap in the clipboard to sFileTo if sFileFr is "" or 0.
Check out my scripts.  (MyIpChanger) (XPSnap) (SavePictureAs) All my scripts are tested on Windows 7, AutoHotkey 32 bit Ansi unless otherwise stated.

dangerdogL2121
  • Members
  • 636 posts
  • Last active: Nov 19 2015 03:39 AM
  • Joined: 22 Dec 2012

Thanks Datalife!

I will be updating my edition of the program to show a float variable of the captures per second.


There is a new AutoHotkey forum here.


Ex0rpl4net
  • Members
  • 87 posts
  • Last active: Jun 25 2015 01:09 PM
  • Joined: 14 May 2013

does it capture the hwnd or the entire screen?

 

i want to capture a part of the screen wich i cannot see-lets say a 9000 by 9000 image wich i cannot resize is this good for my needs?

 

i cannot move it aswell ;)



Rijul Ahuja
  • Members
  • 763 posts
  • Last active: Nov 25 2013 10:16 AM
  • Joined: 14 Mar 2012

^^

You can do that with GDIP.ahk, although I don't know if it can be done with this script.

ScreenPath:="C:\Screens\"
FormatTime, FileName, , D-dd.MM.yy + T-HH.mm.ss
pBitmap := Gdip_BitmapFromScreen("hwnd:" WinExist("Notepad"))
saveFileTo := ScreenPath . fileName . ".jpg"
Gdip_SaveBitmapToFile(pBitmap,saveFileTo,100)
Gdip_DisposeImage(pBitmap)
TrayTip,,Screenshot saved to %SaveFileTo%,1,1
return

Manually include GDIP.ahk in your script.


Abandon the forum. The community has decided in a democratic vote to leave this website because of inactive and perverse administration.

Very few of the contributing members remain here.


dangerdogL2121
  • Members
  • 636 posts
  • Last active: Nov 19 2015 03:39 AM
  • Joined: 22 Dec 2012

Hey,

I don't know if it would help, but would maybe having two almost identical programs that take pictures at the same time and send messages to one another as they took pictures make for faster screen captures?  Maybe even copying the dlls, renaming the copied editions, and using them would speed the picture taking.  It would be cool to get faster capture rates.

thanks


There is a new AutoHotkey forum here.


DataLife
  • Members
  • 1022 posts
  • Last active: Nov 27 2015 01:09 AM
  • Joined: 27 Apr 2008

^^
You can do that with GDIP.ahk, although I don't know if it can be done with this script.

ScreenPath:="C:\Screens\"
FormatTime, FileName, , D-dd.MM.yy + T-HH.mm.ss
pBitmap := Gdip_BitmapFromScreen("hwnd:" WinExist("Notepad"))
saveFileTo := ScreenPath . fileName . ".jpg"
Gdip_SaveBitmapToFile(pBitmap,saveFileTo,100)
Gdip_DisposeImage(pBitmap)
TrayTip,,Screenshot saved to %SaveFileTo%,1,1
return
Manually include GDIP.ahk in your script.

 
I can not get this to work.
 
I have a folder called c:\screens. I have a text file opened in notepad, and I have gdip.ahk  in the script folder.
 
The below script exits without an error and the image does not show up in the screens folder.
#Include gdip.ahk

ScreenPath:="C:\Screens\"
FormatTime, FileName, , D-dd.MM.yy + T-HH.mm.ss
pBitmap := Gdip_BitmapFromScreen("hwnd:" WinExist("Notepad"))
saveFileTo := ScreenPath . fileName . ".jpg"
Gdip_SaveBitmapToFile(pBitmap,saveFileTo,100)
Gdip_DisposeImage(pBitmap)
TrayTip,,Screenshot saved to %SaveFileTo%,1,1
return
I am using this version of gdip.ahk

; Gdip standard library v1.45 by tic (Tariq Porter) 07/09/11
; Modifed by Rseding91 using fincs 64 bit compatible Gdip library 5/1/2013
; Supports: Basic, _L ANSi, _L Unicode x86 and _L Unicode x64

I checked the return value of pBitmap := Gdip_BitmapFromScreen("hwnd:" WinExist("Notepad")) and it was 0.
I checked the return value of Gdip_SaveBitmapToFile(pBitmap,saveFileTo,100) and it was -2 Could not get a list of encoders on system

I don't know what that means.

I am using latest ahk_l ansi 32bit on win7 64bit
Check out my scripts.  (MyIpChanger) (XPSnap) (SavePictureAs) All my scripts are tested on Windows 7, AutoHotkey 32 bit Ansi unless otherwise stated.

noname
  • Members
  • 650 posts
  • Last active:
  • Joined: 12 Nov 2011

You need to start gdip before you can use the commands.

;#Include gdip.ahk   ;if not in your lib dir
SetTitleMatchMode 2

If !pToken := Gdip_Startup()
{
   MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
   ExitApp
}

ScreenPath:="C:\Screens\"
FormatTime, FileName, , D-dd.MM.yy + T-HH.mm.ss

hwnd:=WinExist("Notepad")  ;use the window you want to capture


pBitmap := Gdip_BitmapFromHWND(hwnd)
saveFileTo := ScreenPath . fileName . ".jpg"
Gdip_SaveBitmapToFile(pBitmap,saveFileTo,100)
Gdip_DisposeImage(pBitmap)
msgbox ,,,Screenshot saved to %SaveFileTo%

Gdip_Shutdown(pToken)
exitapp
return

winXP  and ahk unicode


DataLife
  • Members
  • 1022 posts
  • Last active: Nov 27 2015 01:09 AM
  • Joined: 27 Apr 2008
@lain

thanks, that works.
Check out my scripts.  (MyIpChanger) (XPSnap) (SavePictureAs) All my scripts are tested on Windows 7, AutoHotkey 32 bit Ansi unless otherwise stated.

DataLife
  • Members
  • 1022 posts
  • Last active: Nov 27 2015 01:09 AM
  • Joined: 27 Apr 2008
What is causing the "ghosting" and black around the edges? It appears to not be capturing the titlebar and then replacing it with part of the active window that I am capturing. I do not have Scite4AutoHotkey behind Scite4AutoHotkey. I actually have windows photo viewer open without a picture being shown in the viewer.
 
Screenshot 1
GDIPlusScreenShot.jpg
 
 
Screenshot 2 (I moved part of the active window off the right side of the screen)
GDIPlusScreenShot2.jpg
 
Here is the complete script.
 
#Include gdip.ahk
ScreenPath:="C:\Screens\"
^!a::

If !pToken := Gdip_Startup()
{
   MsgBox, 48, gdiplus error!, Gdiplus failed to start. Please ensure you have gdiplus on your system
   ExitApp
}

WinGetActiveTitle,title
WinGet,ActiveTitleHwndID,ID,%title%

FormatTime, FileName, , D-dd.MM.yy + T-HH.mm.ss
pBitmap := Gdip_BitmapFromScreen("hwnd:" ActiveTitleHwndID)
saveFileTo := ScreenPath . fileName . ".jpg"
Gdip_SaveBitmapToFile(pBitmap,saveFileTo,100)

Gdip_DisposeImage(pBitmap)
TrayTip,,Screenshot saved to %SaveFileTo%,1,1
run %savefileto%
return
If the script could capture the titlebar and borders I think it would fix this issue. Looks like the script is not releasing resources or something of that nature.
Check out my scripts.  (MyIpChanger) (XPSnap) (SavePictureAs) All my scripts are tested on Windows 7, AutoHotkey 32 bit Ansi unless otherwise stated.