AutoHotkey Community

It is currently May 27th, 2012, 11:04 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 181 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 13  Next
Author Message
PostPosted: November 22nd, 2007, 10:39 am 
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


Report this post
Top
  
Reply with quote  
PostPosted: November 22nd, 2007, 11:20 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: November 22nd, 2007, 11:45 am 
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!


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2007, 11:56 am 
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 :?:


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2007, 1:40 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 22nd, 2007, 4:34 pm 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2007, 2:17 am 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1833
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/a ... /4346.aspx

and even better (but i dont require it):

http://weblogs.foxite.com/cesarchalom/a ... /4528.aspx

thanks for your time.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2007, 5:05 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2007, 5:13 am 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1833
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2007, 5:28 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2007, 6:18 am 
Offline

Joined: April 22nd, 2007, 6:33 pm
Posts: 1833
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?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 23rd, 2007, 8:37 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 9th, 2007, 6:06 pm 
Offline

Joined: December 9th, 2007, 5:38 pm
Posts: 3
Location: Germany
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!


Report this post
Top
 Profile  
Reply with quote  
PostPosted: December 10th, 2007, 6:55 am 
Offline

Joined: February 12th, 2007, 7:54 am
Posts: 2462
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: January 17th, 2008, 10:23 pm 
Offline

Joined: January 17th, 2008, 10:16 pm
Posts: 1
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 181 posts ]  Go to page Previous  1, 2, 3, 4, 5 ... 13  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: iDrug and 58 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group