 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
tic
Joined: 22 Apr 2007 Posts: 1458
|
Posted: Thu Sep 04, 2008 6:20 pm Post subject: |
|
|
| BoBo² wrote: | Is it possible with that script to have a snapshoot and rescale/downsize it to a variable/preset ratio of eg 33/100% before saving? That to create thumbnail images from screenshoots 'on-the-fly'.
Feedback much appreciated.
 |
I would use the gdi+ library for this |
|
| Back to top |
|
 |
Icarus
Joined: 24 Nov 2005 Posts: 824
|
Posted: Thu Sep 04, 2008 6:25 pm Post subject: |
|
|
| BoBo² wrote: | Is it possible with that script to have a snapshoot and rescale/downsize it to a variable/preset ratio of eg 33/100% before saving? That to create thumbnail images from screenshoots 'on-the-fly'.
Feedback much appreciated.
 |
I am assuming you want something simple and easy enough to implement - so you should download the ScreenCapture.ahk at the top of this thread and read the comments inside.
It has a simple function that gets coordinates and a zoom factor, and it captures and saves PNGs or BMPs or JPGs (I think).
Really easy and useful - I use it to do timed scaled down captures of the screen. _________________ Sector-Seven - Freeware tools built with AutoHotkey |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2225
|
Posted: Thu Sep 04, 2008 10:18 pm Post subject: |
|
|
| BoBo² wrote: | | Is it possible with that script to have a snapshoot and rescale/downsize it to a variable/preset ratio of eg 33/100% before saving? That to create thumbnail images from screenshoots 'on-the-fly'. | There are a variety of ways to do it. GDI+ even has a thumbnail specific function, GdipGetImageThumbnail. Anyway, ScreenCapture.ahk already has this functionality:
| Icarus wrote: | | It has a simple function that gets coordinates and a zoom factor, and it captures and saves PNGs or BMPs or JPGs (I think). Really easy and useful - I use it to do timed scaled down captures of the screen. |
For example,
| Code: | | CaptureScreen("100, 100, 500, 500, 128, 128") | This will capture the region (100,100) ~ (500,500) and save to 128x128 image. |
|
| Back to top |
|
 |
BoBo² Guest
|
Posted: Thu Sep 04, 2008 11:27 pm Post subject: |
|
|
Thx tic/icarus/Sean.
I've oviously missed that specific information within the scripts documentation.  |
|
| Back to top |
|
 |
ScottMattes
Joined: 21 May 2007 Posts: 165 Location: USA
|
|
| Back to top |
|
 |
enmane Guest
|
Posted: Thu Sep 18, 2008 4:00 pm Post subject: Help w/this script |
|
|
I'm currently trying to use this function as a call from another program but it isn't working correctly. I keep getting a screen.bmp file when I desire a JPG. Here's how I'm currently implementing it...
AutoHotkey.ahk has some commands in a loop that call
CaptureScreen(1, False, A_ScriptDir . "\screen.jpg", nQuality:=85)
and I'm using the default settings for CaptureScreen.ahk
1) there are comments commands before
; CaptureScreen() and ;Return
2) the next line is
CaptureScreen(aRect = 0, bCursor = False, sFile= "", nQuality = "") which are the defaults.
Yes, I'm new to scripting but not to programming (but it has been a while).
I've gotten most of my code to work correctly except this part. I know that gdiPlus is working as I tried out Holomind's code and it captured PNGs just fine.
Any ideas??? Sorry if it is obvious. Can I ask someone to give a detailed response? |
|
| Back to top |
|
 |
enmane Guest
|
Posted: Thu Sep 18, 2008 4:00 pm Post subject: Help w/this script |
|
|
I'm currently trying to use this function as a call from another program but it isn't working correctly. I keep getting a screen.bmp file when I desire a JPG. Here's how I'm currently implementing it...
AutoHotkey.ahk has some commands in a loop that call
CaptureScreen(1, False, A_ScriptDir . "\screen.jpg", nQuality:=85)
and I'm using the default settings for CaptureScreen.ahk
1) there are comments commands before
; CaptureScreen() and ;Return
2) the next line is
CaptureScreen(aRect = 0, bCursor = False, sFile= "", nQuality = "") which are the defaults.
Yes, I'm new to scripting but not to programming (but it has been a while).
I've gotten most of my code to work correctly except this part. I know that gdiPlus is working as I tried out Holomind's code and it captured PNGs just fine.
Any ideas??? Sorry if it is obvious. Can I ask someone to give a detailed response? |
|
| Back to top |
|
 |
enmane Guest
|
Posted: Thu Sep 18, 2008 4:45 pm Post subject: I think I have it figured out |
|
|
Ok, well - the following is working at creating a screen.jpg file
CaptureScreen(1, False, "screen.JPG", 85)
but now I need to change the names automatically and I looked at the code in Holomind's script and put the following before the call to CaptureScreen
FormatTime, myTime, , yyyyMMdd_hhmmss
fileNameDestP = screens_%myTime%_%LoopCount%.JPG
CaptureScreen(1, False, %fileNameDestP%, 85)
so that it automatically changes the filename but I get an error with the variable %fileNameDestP% when it gets passed to CaptureScreen....
Error: The following variable name contains an illegal character : "screens_20080918_114420_1.JPG"
Any ideas and TIA... |
|
| Back to top |
|
 |
enmane Guest
|
Posted: Thu Sep 18, 2008 6:43 pm Post subject: Never mind |
|
|
I thought I already tried passing it by reference and not by value but it's working now just by removing % signs and passing the variable...
CaptureScreen(1, False, %fileNameDestP%, 85)
CaptureScreen(1, False, fileNameDestP, 85)
works good now |
|
| Back to top |
|
 |
BioBrain
Joined: 13 Feb 2008 Posts: 17 Location: Jakarta-Indonesia
|
Posted: Sat Oct 04, 2008 2:56 pm Post subject: |
|
|
| Anonymous wrote: | | BioBrain wrote: | | I've been thinking, do U thing it's possible to search is image in clipboard is the same with image I want 2 search. kinda like ImageSearch but not on screen, but search in the Clipboard. |
Sure it's possible. You can obtain, using GetClipboardData(), hbitmap (:DDB) or DIB. All necessary ones are ready by now. The remaining question is what procedure you're gonna use for the search, GetPixel through memory dc, where hbitmap is useful but maybe the slowest, or compare raw pixel, where DIB is handy, one by one, or may use hashes of the data. |
GetClipboardData(), hbitmap (:DDB) or DIB ?
Any posted topic or tutorials about it? because I can't find it at AutoHotkey help.
Tx.  |
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 427
|
Posted: Fri Jan 02, 2009 8:43 am Post subject: |
|
|
| Can someone help me adjust this to capture the entire desktop (multiple monitors) instead of just the primary monitor? |
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 427
|
Posted: Fri Jan 02, 2009 9:13 am Post subject: |
|
|
| adamrgolf wrote: | | Can someone help me adjust this to capture the entire desktop (multiple monitors) instead of just the primary monitor? |
I've got this fixed, atleast for dual monitors by adjusting the if !aRect in CaptureScreen() function to this:
| Code: | If !aRect
{
SysGet, Mon, Monitor, 1
nL := MonLeft
nT := MonTop
nW := MonRight - MonLeft
nH := MonBottom - MonTop
SysGet, Mon, Monitor, 2
nL2 := MonLeft
nT2 := MonTop
nW2 := MonRight - MonLeft
nH2 := MonBottom - MonTop
nL := nL + nL2
nT := nT + nT2
nW := nW + nW2
if nH2 >= nH
nH := nH2
} |
|
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2225
|
Posted: Fri Jan 02, 2009 10:33 am Post subject: |
|
|
| adamrgolf wrote: | | Can someone help me adjust this to capture the entire desktop (multiple monitors) instead of just the primary monitor? |
You can use
| Code: | If !aRect
{
SysGet, nL, 76
SysGet, nT, 77
SysGet, nW, 78
SysGet, nH, 79
}
|
|
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 427
|
Posted: Fri Jan 02, 2009 1:33 pm Post subject: |
|
|
| Sean wrote: | | adamrgolf wrote: | | Can someone help me adjust this to capture the entire desktop (multiple monitors) instead of just the primary monitor? |
You can use
| Code: | If !aRect
{
SysGet, nL, 76
SysGet, nT, 77
SysGet, nW, 78
SysGet, nH, 79
}
|
|
I see, thanks  |
|
| Back to top |
|
 |
adamrgolf
Joined: 28 Dec 2006 Posts: 427
|
Posted: Fri Jan 02, 2009 1:51 pm Post subject: |
|
|
Irfanview offers an option to capture just the active screen. I wanted to do it with this, since it offers the option to not capture the mouse cursor.
What do you think about adding the following (or something similar) to your code, Sean?
| Code: | Else If aRect = 3
{
MouseGetPos,mPx,mPy
SysGet,mC,MonitorCount
Loop % mC
{
SysGet, Mon, Monitor, %A_Index%
nL := MonLeft
nT := MonTop
nW := MonRight - MonLeft
nH := MonBottom - MonTop
If ((mPx >= nL) AND (mPx <= nW)) AND ((mPy >= nT) AND (mPy <= nH))
Break
}
} |
Then option 3 would be to capture just the active screen, ie the monitor where your mouse is currently. Such as:
| Code: | | CaptureScreen(3,false,"c:\active_screen.bmp") |
Last edited by adamrgolf on Fri Jan 02, 2009 3:01 pm; edited 1 time in total |
|
| 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
|