AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Screen Capture with Transparent Windows and Mouse Cursor
Goto page Previous  1, 2, 3, 4  Next
 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
guest12
Guest





PostPosted: Thu Nov 22, 2007 10:39 am    Post subject: Re: Screen Capture with Transparent Windows and Mouse Cursor Reply with quote

Sean wrote:
I know that there already exist script(s) of the kind. Then, why another one?
It'll also capture the transparent windows and/or the mouse cursor, according to the options.
Please read the comments in the script for the details.

PS. It REQUIREs GdiPlus.dll.

DOWNLOAD ScreenCapture.ahk.


hello!
congratulation for script!
i try to launch in windows 2000 and it doesnt't work.
why?

this is the "log"

Script lines most recently executed (oldest first). Press [F5] to refresh. The seconds elapsed between a line and the one after it is in parentheses to the right (if not 0). The bottommost line's elapsed time is the number of seconds since it executed.

023: CaptureScreen()
028: if !aRect
029: {
030: SysGet,Mon,Monitor,1
031: nL := MonLeft
032: nT := MonTop
033: nW := MonRight - MonLeft
034: nH := MonBottom - MonTop
035: }
060: hDC := DllCall("GetDC", "Uint", 0)
061: mDC := DllCall("CreateCompatibleDC", "Uint", hDC)
062: hBM := DllCall("CreateCompatibleBitmap", "Uint", hDC, "int", nW, "int", nH)
063: oBM := DllCall("SelectObject", "Uint", mDC, "Uint", hBM)
064: DllCall("BitBlt", "Uint", mDC, "int", 0, "int", 0, "int", nW, "int", nH, "Uint", hDC, "int", nL, "int", nT, "Uint", 0x40000000 | 0x00CC0020)
065: if bCursor
067: DllCall("SelectObject", "Uint", mDC, "Uint", oBM)
068: DllCall("DeleteDC", "Uint", mDC)
069: if znW && znH
071: if sFile = 0
073: Convert(hBM, sFile)
122: if !sFileTo
124: sFileTo := "C:\" A_DD "_" A_MMM "_" A_Hour "_" A_Min ".bmp"
125: SplitPath,sFileTo,,,sExtTo
127: hGdiPlus := DllCall("LoadLibrary", "str", "gdiplus.dll")
128: VarSetCapacity(si, 16, 0), si := Chr(1)
129: DllCall("gdiplus\GdiplusStartup", "UintP", pToken, "Uint", &si, "Uint", 0)
130: DllCall("gdiplus\GdipGetImageEncodersSize", "UintP", nCount, "UintP", nSize)
131: VarSetCapacity(ci, nSize)
132: DllCall("gdiplus\GdipGetImageEncoders", "Uint", nCount, "Uint", nSize, "Uint", &ci)
134: Loop,%nCount%
142: if !sFileFr
149: if sFileFr is Integer
150: DllCall("gdiplus\GdipCreateBitmapFromHBITMAP", "Uint", sFileFr, "Uint", 0, "UintP", pImage)
153: if pImage
156: DllCall("gdiplus\GdiplusShutdown" , "Uint", pToken)
157: DllCall("FreeLibrary", "Uint", hGdiPlus)
158: }
074: DllCall("DeleteObject", "Uint", hBM)
075: DllCall("ReleaseDC", "Uint", 0, "Uint", hDC)
076: }
027: {
079: {
104: {
121: {
161: {
172: {
180: { (32.77)


thanks
Back to top
Sean



Joined: 12 Feb 2007
Posts: 1281

PostPosted: Thu Nov 22, 2007 11:20 am    Post subject: Re: Screen Capture with Transparent Windows and Mouse Cursor Reply with quote

guest12 wrote:
Sean wrote:
PS. It REQUIREs GdiPlus.dll.

i try to launch in windows 2000 and it doesnt't work.

W2K doesn't have GdiPlus.dll which is needed to save the captured screen-shot to a file on HDD. I think MS provides GdiPlus.dll as a redistributed one, so you may download it. Or, I may extend the script to not use GdiPlus.dll when it's not found, however, you'll able to save to BMP only in this case.
Back to top
View user's profile Send private message
guest12
Guest





PostPosted: Thu Nov 22, 2007 11:45 am    Post subject: Re: Screen Capture with Transparent Windows and Mouse Cursor Reply with quote

Sean wrote:
guest12 wrote:
Sean wrote:
PS. It REQUIREs GdiPlus.dll.

i try to launch in windows 2000 and it doesnt't work.

W2K doesn't have GdiPlus.dll which is needed to save the captured screen-shot to a file on HDD. I think MS provides GdiPlus.dll as a redistributed one, so you may download it. Or, I may extend the script to not use GdiPlus.dll when it's not found, however, you'll able to save to BMP only in this case.



great!
thank you!
Back to top
BoBoĻ
Guest





PostPosted: Thu Nov 22, 2007 11:56 am    Post subject: Reply with quote

Based on a request regarding a text-highlighter, I thought about if it would be possible to specify an area, copy its content to the clipboard (aka having a screenshot, right?), change one color of the captured content (eg. black to yellow, to mimik the "highlighting" of a text) and 'repaint' the original/source/screen area with that edited screenshot.

Complete nonsense Question
Back to top
Sean



Joined: 12 Feb 2007
Posts: 1281

PostPosted: Thu Nov 22, 2007 1:40 pm    Post subject: Reply with quote

BoBoĻ wrote:
change one color of the captured content (eg. black to yellow, to mimik the "highlighting" of a text)

I suppose you want to change only the color of the text, i.e., without affecting the color of the background. Then, the obvious question is how to identify/confine the region of the text programmatically? I don't think it's an easy job if not impossible.
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 1281

PostPosted: Thu Nov 22, 2007 4:34 pm    Post subject: Reply with quote

The script is updated so as to save the screen capture to a .bmp file (even) when GdiPlus.dll is not found in the system.
Back to top
View user's profile Send private message
tic



Joined: 22 Apr 2007
Posts: 1334

PostPosted: Fri Nov 23, 2007 2:17 am    Post subject: Reply with quote

Sean (or anyone else) do you know how to convert to an .ico? I am trying to help someone, and it would be useful to be able to convert for example from a bmp to an ico, even if it doesnt have different sizes, it would be useful to just convert to 32x32 ico with the fewest number of colours. I have been reading a bit, but I dont have enough knowledge about gdiplus, so the going is slow Sad

If you understand this then it would be very useful:

http://weblogs.foxite.com/cesarchalom/archive/2007/07/13/4346.aspx

and even better (but i dont require it):

http://weblogs.foxite.com/cesarchalom/archive/2007/08/14/4528.aspx

thanks for your time.
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 1281

PostPosted: Fri Nov 23, 2007 5:05 am    Post subject: Reply with quote

tic wrote:
Sean (or anyone else) do you know how to convert to an .ico?

There exist a simple method to create hIcon from an image file using GDI+, although it's not perfect: GdipLoadImageFromFile/GdipCreateBitmapFromFile & GdipCreateHICONFromBitmap. AFAIK, however, there doesn't exist a simple way to save hIcon to a .ico file. To achieve it, you have to follow the step shown in the second linked page in your post, which I don't want to go into it myself, at least for now.
Back to top
View user's profile Send private message
tic



Joined: 22 Apr 2007
Posts: 1334

PostPosted: Fri Nov 23, 2007 5:13 am    Post subject: Reply with quote

Quote:
There exist a simple method to create hIcon from an image file using GDI+, although it's not perfect: GdipLoadImageFromFile/GdipCreateBitmapFromFile & GdipCreateHICONFromBitmap.


So you mean it converts it, but then cant be written to a file? What state is it in so that it cant be written to a file? Would there be any way to create a tray icon directly from this hIcon?

Also, would the 1st link be any easier to do? Im really gtting lost on the gdi+ front. where have you read all this stuff? I tried searching and couldnt find anything useful, such as all the gdiplus functions.
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 1281

PostPosted: Fri Nov 23, 2007 5:28 am    Post subject: Reply with quote

tic wrote:
What state is it in so that it cant be written to a file?

You cannot directly save device-dependent memory objects, hBitmapColor and hBitmapMask in hIcon case, to a file.
Quote:
Would there be any way to create a tray icon directly from this hIcon?

Yes it does. Read about Shell_NotifyIcon, which is also included in my TrayIcons script.
Quote:
Also, would the 1st link be any easier to do? Im really gtting lost on the gdi+ front.

It doesn't use GDI+, does use OLE function(s) which used to be useful before the advent of GDI+. And, it uses its site's own custom function to save to .ico.
Quote:
where have you read all this stuff? I tried searching and couldnt find anything useful, such as all the gdiplus functions.

MSDN, especially GDI+'s Flat APIs.
Back to top
View user's profile Send private message
tic



Joined: 22 Apr 2007
Posts: 1334

PostPosted: Fri Nov 23, 2007 6:18 am    Post subject: Reply with quote

Quote:
Yes it does. Read about Shell_NotifyIcon, which is also included in my TrayIcons script.


Im not sure that youre answering the question im trying to ask. i dont mean, can i create a whole new tray icon. i mean, is it possible to change the scripts icon from a bmp as its source image (as you said it was possible to convert to a hIcon, but hard to write this to .ico). So could a bmp be used as a tray icon for the current script then without having to convert and write it to an .ico file?
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 1281

PostPosted: Fri Nov 23, 2007 8:37 am    Post subject: Reply with quote

tic wrote:
So could a bmp be used as a tray icon for the current script then without having to convert and write it to an .ico file?

I already answered that. First read about Shell_NotifyIcon, it can add/modify/delete trayicon.
Back to top
View user's profile Send private message
impecco



Joined: 09 Dec 2007
Posts: 3
Location: Germany

PostPosted: Sun Dec 09, 2007 6:06 pm    Post subject: Save images from clipboard to file Reply with quote

This miraculous script also solves some "old" problem discussed in
http://www.autohotkey.com/forum/post-164741.html#164741
which is to save an image in the clipboard to a file.
See impecco's posting.
_________________
Impecco: Rerum Cognoscere Causas!
Back to top
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 1281

PostPosted: Mon Dec 10, 2007 6:55 am    Post subject: Re: Save images from clipboard to file Reply with quote

impecco wrote:
http://www.autohotkey.com/forum/post-164741.html#164741
which is to save an image in the clipboard to a file.
See impecco's posting.

In fact, I was thinking about updating that part to use DIB. If you encounter a problem with the current one, please post here.
Back to top
View user's profile Send private message
winngy



Joined: 17 Jan 2008
Posts: 1

PostPosted: Thu Jan 17, 2008 10:23 pm    Post subject: Reply with quote

Hi guys new here (well new to posting)

Could some help me make this script do the following

1. Loop and take a screenshot of the client area of a window every second.

2. save the files as frame000.bmp , frame001.bmp.........frame999.bmp. In folder created by me.

I can add a line to sctivate the window in question and i can add the loop , but if you could also enable a hotkey escape.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3, 4  Next
Page 2 of 4

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group