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 ... 7, 8, 9, 10, 11, 12  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Mon Oct 12, 2009 12:41 am    Post subject: Reply with quote

My preference is using 4 separate thin bars/GUIs than using a big transparent GUI.
Back to top
View user's profile Send private message
..:: Free Radical ::..



Joined: 20 Sep 2006
Posts: 72

PostPosted: Thu Dec 10, 2009 12:06 am    Post subject: Reply with quote

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
View user's profile Send private message
Trigun
Guest





PostPosted: Mon Jan 25, 2010 3:43 am    Post subject: Reply with quote

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

PostPosted: Tue Feb 02, 2010 10:25 pm    Post subject: Reply with quote

@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
View user's profile Send private message
tsc



Joined: 31 Mar 2010
Posts: 1

PostPosted: Wed Mar 31, 2010 10:57 pm    Post subject: Reply with quote

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
View user's profile Send private message
CyberGeek



Joined: 18 Apr 2010
Posts: 159

PostPosted: Tue Apr 20, 2010 3:54 pm    Post subject: Reply with quote

try this i made using sc

http://www.autohotkey.com/forum/viewtopic.php?t=57127
Back to top
View user's profile Send private message
closed



Joined: 07 Feb 2008
Posts: 509

PostPosted: Mon May 03, 2010 11:06 am    Post subject: Reply with quote

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
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Mon May 03, 2010 12:41 pm    Post subject: Reply with quote

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
View user's profile Send private message
closed



Joined: 07 Feb 2008
Posts: 509

PostPosted: Mon May 03, 2010 3:40 pm    Post subject: Reply with quote

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
View user's profile Send private message
Sean



Joined: 12 Feb 2007
Posts: 2462

PostPosted: Tue May 04, 2010 12:30 am    Post subject: Reply with quote

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
View user's profile Send private message
Björn-Uwe
Guest





PostPosted: Sat May 15, 2010 11:31 pm    Post subject: Script stays persitent after modification... Reply with quote

..:: 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

PostPosted: Mon May 17, 2010 9:04 am    Post subject: Reply with quote

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
View user's profile Send private message
Nimmzo



Joined: 05 Aug 2010
Posts: 1

PostPosted: Thu Aug 05, 2010 4:20 pm    Post subject: Screencapture vs. PrtSc key Reply with quote

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 Wink

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
View user's profile Send private message
AngelicCare



Joined: 25 Aug 2010
Posts: 18

PostPosted: Sat Sep 04, 2010 4:02 pm    Post subject: Reply with quote

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
View user's profile Send private message
Guest






PostPosted: Mon Sep 06, 2010 7:56 pm    Post subject: Reply with quote

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
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Goto page Previous  1, 2, 3 ... 7, 8, 9, 10, 11, 12  Next
Page 8 of 12

 
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