 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
guest12 Guest
|
Posted: Thu Nov 22, 2007 10:39 am Post subject: Re: Screen Capture with Transparent Windows and Mouse Cursor |
|
|
| 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
|
Posted: Thu Nov 22, 2007 11:20 am Post subject: Re: Screen Capture with Transparent Windows and Mouse Cursor |
|
|
| 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 |
|
 |
guest12 Guest
|
Posted: Thu Nov 22, 2007 11:45 am Post subject: Re: Screen Capture with Transparent Windows and Mouse Cursor |
|
|
| 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
|
Posted: Thu Nov 22, 2007 11:56 am Post subject: |
|
|
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  |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1281
|
Posted: Thu Nov 22, 2007 1:40 pm Post subject: |
|
|
| 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 |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1281
|
Posted: Thu Nov 22, 2007 4:34 pm Post subject: |
|
|
| 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 |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1334
|
Posted: Fri Nov 23, 2007 2:17 am Post subject: |
|
|
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
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 |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1281
|
Posted: Fri Nov 23, 2007 5:05 am Post subject: |
|
|
| 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 |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1334
|
Posted: Fri Nov 23, 2007 5:13 am Post subject: |
|
|
| 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 |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1281
|
Posted: Fri Nov 23, 2007 5:28 am Post subject: |
|
|
| 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 |
|
 |
tic
Joined: 22 Apr 2007 Posts: 1334
|
Posted: Fri Nov 23, 2007 6:18 am Post subject: |
|
|
| 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 |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1281
|
Posted: Fri Nov 23, 2007 8:37 am Post subject: |
|
|
| 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 |
|
 |
impecco
Joined: 09 Dec 2007 Posts: 3 Location: Germany
|
Posted: Sun Dec 09, 2007 6:06 pm Post subject: Save images from clipboard to file |
|
|
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 |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 1281
|
Posted: Mon Dec 10, 2007 6:55 am Post subject: Re: Save images from clipboard to file |
|
|
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 |
|
 |
winngy
Joined: 17 Jan 2008 Posts: 1
|
Posted: Thu Jan 17, 2008 10:23 pm Post subject: |
|
|
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 |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|