 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Mon Oct 12, 2009 12:41 am Post subject: |
|
|
| My preference is using 4 separate thin bars/GUIs than using a big transparent GUI. |
|
| Back to top |
|
 |
..:: Free Radical ::..
Joined: 20 Sep 2006 Posts: 72
|
Posted: Thu Dec 10, 2009 12:06 am Post subject: |
|
|
I added these
| Code: |
Else If aRect = 4
{
MouseGetPos, x1, y1
Sleep, 5000
MouseGetPos, x2, y2
nL := x1
nT := y1
nW := x2 - x1
nH := y2 - y1
}
Else If aRect = 5
{
MySelectRect(x1, y1, x2, y2)
nL := x1
nT := y1
nW := x2 - x1
nH := y2 - y1
}
Else If aRect = 6
{
MySelectRect2(x1, y1, x2, y2)
nL := x1
nT := y1
nW := x2 - x1
nH := y2 - y1
}
|
| Code: |
MySelectRect(ByRef x1, ByRef y1, ByRef x2, ByRef y2)
{
KeyWait, LButton, D
MouseGetPos, x1, y1
Sleep, 1000
Gui, +AlwaysOnTop -caption +Border +ToolWindow +LastFound
WinSet, Transparent, 150
Gui, Color, yellow
While, !(GetKeyState("LButton", "p"))
{
MouseGetPos, x2, y2
w := abs(x1 - x2)
h := abs(y1 - y2)
If ( x1 < x2 )
X := x1
Else
X := x2
If ( y1 < y2 )
Y := y1
Else
Y := y2
Gui, Show, x%X% y%Y% w%w% h%h%
Sleep, 10
}
MouseGetPos, x2, y2
Gui, Destroy
If ( x1 > x2 )
{
temp := x1
x1 := x2
x2 := temp
}
If ( y1 > y2 )
{
temp := y1
y1 := y2
y2 := temp
}
Area = %x1%, %y1%, %x2%, %y2%
Sleep, 100
return
}
MySelectRect2(ByRef x1, ByRef y1, ByRef x2, ByRef y2)
{
KeyWait, LButton, D
MouseGetPos, x1, y1
Gui, +AlwaysOnTop -caption +Border +ToolWindow +LastFound
WinSet, Transparent, 80
Gui, Color, lime
While, (GetKeyState("LButton", "p"))
{
MouseGetPos, x2, y2
w := abs(x1 - x2)
h := abs(y1 - y2)
If ( x1 < x2 )
X := x1
Else
X := x2
If ( y1 < y2 )
Y := y1
Else
Y := y2
Gui, Show, x%X% y%Y% w%w% h%h%
Sleep, 10
}
MouseGetPos, x2, y2
Gui, Destroy
If ( x1 > x2 )
{
temp := x1
x1 := x2
x2 := temp
}
If ( y1 > y2 )
{
temp := y1
y1 := y2
y2 := temp
}
Area = %x1%, %y1%, %x2%, %y2%
Sleep, 100
return
}
|
MySelectRect: Click once and hover to make a selection
MySelectRect2: Press and hold Left mouse button to make a selection |
|
| Back to top |
|
 |
Trigun Guest
|
Posted: Mon Jan 25, 2010 3:43 am Post subject: |
|
|
hi,
i haven't read all the post ... is possible to save an area x,y,x,y of the active window? |
|
| Back to top |
|
 |
TomXIII
Joined: 14 Apr 2009 Posts: 182
|
Posted: Tue Feb 02, 2010 10:25 pm Post subject: |
|
|
@Trigun:
Yes, you can!
Get the upper/left corner position of your wanted window (WinGetPos)
And play with upper/left corner of the wanted area from the last point found.
Be carefull with CoordMode! |
|
| Back to top |
|
 |
tsc
Joined: 31 Mar 2010 Posts: 1
|
Posted: Wed Mar 31, 2010 10:57 pm Post subject: |
|
|
| What would I have to do to be able to specify the color depth of an output bitmap? Full color bitmaps are usually pretty big, but a 16 color bitmap is sufficiently clear and small for stuffing in an email. |
|
| Back to top |
|
 |
CyberGeek
Joined: 18 Apr 2010 Posts: 159
|
|
| Back to top |
|
 |
closed
Joined: 07 Feb 2008 Posts: 509
|
Posted: Mon May 03, 2010 11:06 am Post subject: |
|
|
Using the screencapture function on small selections i found that the captured rectangle was smaller by 1pixel than the selected using its coordinates by mousegetpos.
| Quote: | | aRect can be comma delimited sequence of coordinates, e.g., "Left, Top, Right, Bottom" |
| Code: | Else
{
StringSplit, rt, aRect, `,, %A_Space%%A_Tab%
nL := rt1
nT := rt2
nW := rt3 - rt1
nH := rt4 - rt2
znW := rt5
znH := rt6
} |
I had to change this by adding 1 pixel
nW := rt3 - rt1 + 1
nH := rt4 - rt2 + 1
if you look at an image 10x10 you get pixel coordinates 0,0 and 9,9
so it returns an image 9x9
or am I mistaken ? |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Mon May 03, 2010 12:41 pm Post subject: |
|
|
| Rect(angle) is left/top inclusive and right/bottom exclusive. So, if you want 10x10 rectangle, you have to specify (0,0) - (10,10), as in, for example, (0,0) - (A_ScreenWidth, A_ScreenHeight) for the whole screen (:check the coordinates of the left/top/right/bottom edges of your screen). |
|
| Back to top |
|
 |
closed
Joined: 07 Feb 2008 Posts: 509
|
Posted: Mon May 03, 2010 3:40 pm Post subject: |
|
|
Thanks Sean
That explains the result but then i leave the +1 so the selection is from screencoordinates given by the mouseposition so i can use these values directly. |
|
| Back to top |
|
 |
Sean
Joined: 12 Feb 2007 Posts: 2462
|
Posted: Tue May 04, 2010 12:30 am Post subject: |
|
|
| yume wrote: | | That explains the result but then i leave the +1 so the selection is from screencoordinates given by the mouseposition so i can use these values directly. | It's the rule of Windows itself, so IMO you'd better tweak the code retrieving right/bottom than the formulas of width/height. |
|
| Back to top |
|
 |
Björn-Uwe Guest
|
Posted: Sat May 15, 2010 11:31 pm Post subject: Script stays persitent after modification... |
|
|
| ..:: Free Radical ::.. wrote: | I added these
...
MySelectRect: Click once and hover to make a selection
MySelectRect2: Press and hold Left mouse button to make a selection |
If you want the Gui to Exit in the end, use ExitApp instead of Return |
|
| Back to top |
|
 |
Chicken Pie 4 Tea
Joined: 18 Aug 2009 Posts: 375 Location: holland
|
Posted: Mon May 17, 2010 9:04 am Post subject: |
|
|
so this script captures the screen and puts the output in clipboard.
but I can just press PrtSc on my keyboard for that
is this script using the same inbuilt windows funcitons as the prtsc key does? _________________ "Choose your parents wisely" |
|
| Back to top |
|
 |
Nimmzo
Joined: 05 Aug 2010 Posts: 1
|
Posted: Thu Aug 05, 2010 4:20 pm Post subject: Screencapture vs. PrtSc key |
|
|
Screencapture vs. PrtSc key
| mouse wrote: | | I can just press PrtSc on my keyboard for that |
Mouse, the PtrSc key will capture the screen in the clipboard without the mouse pointeur.
You could be concerned with such a nickname
With sc_CaptureScreen, you can specify if you want the mouse pointer or not in your .ahk script:
| Code: | ; Ctrl + PrintScreen captures the full screen aRect = 0, bCursor = true, sFileTo = 0 in clipboard
^PrintScreen::
sc_CaptureScreen(0, True, 0)
return
; Ctrl Alt + PrintScreen captures the active window aRect = 1, bCursor, sFileTo = 0 in clipboard
^!PrintScreen::
sc_CaptureScreen(1, True, 0)
return
|
|
|
| Back to top |
|
 |
AngelicCare
Joined: 25 Aug 2010 Posts: 18
|
Posted: Sat Sep 04, 2010 4:02 pm Post subject: |
|
|
Didn't work for cursor in http://www.siegeonline.ru/ru/start.asp SiegeOnline game (sorry, it's Russian)
...
IrfanView's screenshot with mouse, however, worked. Any tips on getting on the right way? |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Sep 06, 2010 7:56 pm Post subject: |
|
|
I am using
CaptureScreen(0,false,"FCHotkeyImgs\blat\screencapture%A_ComputerName%.png")
But since the path is in quotes is there any way to get a varible in the path so I do not end up with several computers accessing the file at the same time. I have this capturing errors and wanted to add a screen capture of the current state in with the email it sends. |
|
| 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
|