Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

ScreenMagnifier


  • Please log in to reply
104 replies to this topic
Jamn
  • Guests
  • Last active:
  • Joined: --
I've the second script in holominds first post in this thread to work. It is wonderful! But that script has no pointer or cross or anything that shows the mouse position. I tried to import those parts from some of the scripts later in the thread but then I failed.

Can someone help me out here? What is the simplest way to "add on" some small mouse position helper to that first script?

Most of all I'd like to have only a small but noticeable black dot that moves in sync with the mouse position.

(I plan to use the script on one monitor to navigate on an second monitor that is in another room, that's why I need more detailed mouse position information)

jamn
  • Guests
  • Last active:
  • Joined: --
Ok, I've gotten the hang of how to draw the cross the way I want it now. To do that I had to disable the part in holomind's script that makes sure nothing outside of the display gets painted. This change results in a type of "ghosting" in those outside areas, when moving the mouse to the edge of a screen.

Can I avoid that ghosting by making the script repaint all outside areas with black?

jamn
  • Guests
  • Last active:
  • Joined: --
I have an idea: could the script at each repaint first fill the whole area with black pixels and then immediately repaint it again according to the pointer position? That could remove ghosting. But maybe it would slow things down or create som black flickering. Can anyone help me test that? I suspect I should use some other bitmap function for that, but I can't get the hang of it. http://msdn2.microso.../ms532355(VS.85).aspx

foaly
  • Guests
  • Last active:
  • Joined: --
I'm searching for a full size screen magnifier (magnify the entire screen.)
Somehow the screen magnifiers I found on this forum don't work when your mouse is in the magnifying area, unless you open a menu (for instance right click.) I'm using windows vista.
Anyone has a solution to that?

infogulch
  • Moderators
  • 717 posts
  • Last active: Jul 31 2014 08:27 PM
  • Joined: 27 Mar 2008
I've been using "SetWinDelay, -1" for many of these and it makes all the windows move smoother. "SetBatchLines, -1" and "Process, Priority,, High" along with a repaint timer around 5ms makes that part somewhat smoother for me.

unregistered
  • Guests
  • Last active:
  • Joined: --
i keep getting this error:

Posted Image

BoBo²
  • Guests
  • Last active:
  • Joined: --
holomind wrote:

... often its difficult to work with video as it gets blacked out.

No idea if someone pointed out already to check the the system for its 'overlay'-setting. Often its said that you'll have that problem if you wanna do a screenshot from a running video ...

netboom
  • Members
  • 118 posts
  • Last active: May 21 2015 04:59 PM
  • Joined: 06 Jul 2008
If I wanted to fix the magnify window and not have it follow the mouse and only magnify whats under the window how would i go about this? can I modify this script to do this? I'm new to ahk so any help would be great.

Thanks,

Net.

jdpmd
  • Guests
  • Last active:
  • Joined: --
If I add magnifier radiobuttons to the Magnifier window, it works initially, but then a click on a radiobutton and it no longer magnifies.
It seems like click on radiobutton activates a repaint routine that blocks or over-rides the MagRepaint. How can I turn that off so Magnify resumes?
Gui 2:+AlwaysOnTop +Resize +ToolWindow
Gui 2:Add, GroupBox, vMagBox w600 h100 xm ym
Gui 2:Add,Radio, gSetMag xm+10   ym+5 vMagRad checked, 2x
Gui 2:Add,Radio, gSetMag xm+50   ym+5, 3x
Gui 2:Add,Radio, gSetMag xm+90   ym+5, 4x
Gui 2:Add,Radio, gSetMag xm+140  ym+5, 5x
Gui 2:Add,Radio, gSetMag xm+170  ym+5, 6x
Gui 2:Add,Text, xm+10 ym+55, Click on magnification factor
Gui 2:Show, % "w" 2*Rx " h" 2*Ry " x0 y0", Magnifier
SetTimer MagRepaint, 50    ; flow through
setMag:
   zoom:=MagRad+1
   Zx := Rx/zoom
   Zy := Ry/zoom
   TrayTip,,% "Frame  =  " Round(2*Zx) " × " Round(2*Zy) "`nMagnified to = " A_GuiWidth "×" A_GuiHeight
   Gui,2:hide
   Gui,2:show
return
MagRepaint:
   MouseGetPos x, y, WinUnderID
   if (WinUnderID = MagnifierID)
   { ; then just show the mag radio buttons
    GuiControl, 2:MoveDraw, MagBox, xm ym
    return
   }
   xz := In(x-Zx-6,0,A_ScreenWidth-2*Zx) ; keep the frame on screen
   yz := In(y-Zy-6,0,A_ScreenHeight-2*Zy)
  ; WinMove Frame,,%xz%, %yz%, % 2*Zx, % 2*Zy
   DllCall("gdi32.dll\StretchBlt", UInt,hdc_frame, Int,0, Int,0, Int,2*Rx, Int,2*Ry
   , UInt,hdd_frame, UInt,xz, UInt,yz, Int,2*Zx, Int,2*Zy, UInt,0xCC0020) ; SRCCOPY
Return


automaticman
  • Members
  • 658 posts
  • Last active: Nov 20 2012 06:10 PM
  • Joined: 27 Oct 2006

If I play Internet Chess, the time display is too small. It would be nice to be able to show it 4 times magnified in the top center part of the screen, updated real time.

Hi Laszlo, are you using also AutoHotkey intelligence for playing internet chess, I am asking only out of curiosity.

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
No, just playing w/o any tools.

MiL0
  • Members
  • 27 posts
  • Last active: Jul 10 2011 11:01 PM
  • Joined: 06 Sep 2010
Is there an easy way to edit this script so that it shows two (or more) cloned/zoomed displays? What I want to do is be able to re-arrange the GUI of a program that is laid out in a non-desirable way. I'd also like to be able to re-size the output windows so that they distort (don't maintain aspect ratio)... anyone up to it? (I'd be willing to donate a bit of cash!)

MiL0
  • Members
  • 27 posts
  • Last active: Jul 10 2011 11:01 PM
  • Joined: 06 Sep 2010
okay, so I've worked out how to get more than one instance running (just ran two ahk's with different filenames lol) and I've managed to get the windows to stay put and clone a specific area. The last thing I want to work out is how to get the GUI / GDI commands to distort when I change the window size... any ideas?

edit: it appears I need to change this line:

DllCall("gdi32.dll\StretchBlt", UInt,hdc_frame, Int,0, Int,0, Int,2*Rx, Int,2*Ry
   , UInt,hdd_frame, UInt,xz, UInt,yz, Int,2*Zx, Int,2*Zy, UInt,0xCC0020) ; SRCCOPY

but it's well beyond my understanding... here's some documentation on the stretchblt function:

http://msdn.microsoft.com/en-us/library/dd145120(VS.85).aspx


MiL0
  • Members
  • 27 posts
  • Last active: Jul 10 2011 11:01 PM
  • Joined: 06 Sep 2010
any ideas? :)

jonjan
  • Members
  • 34 posts
  • Last active: Feb 25 2013 01:21 PM
  • Joined: 21 Mar 2006
Hey, these codes and all the variations are really good :D

Can these scripts be made to toggle on and off with a keyboard hotkey?

And is it possible to get the same level of preciseness if this zoom is modified to be a loupe-type (zoom window where the pointer is)?

The code I'm trying to work on is holomind's variations on Trombonisto's double-crosshair code:


#NoEnv
SetBatchLines -1

CoordMode Mouse, Screen
OnExit #x
  zoom = 8                ; initial magnification, 1..32
  halfside = 128          ; circa halfside of the magnifier
  part := halfside/zoom
  Rz := Round(part)
  R := Rz*zoom
  LineMargin := 10
                        ; GUI 2 shows the magnified image
Gui 2:+AlwaysOnTop -Caption +Resize +ToolWindow +E0x20
Gui 2:Show, % "w" 2*R+zoom+3 " h" 2*R+zoom+3 " x0 y0", Magnifier
WinGet MagnifierID, id,  Magnifier
WinSet Transparent, 255, Magnifier ; makes the window invisible to magnification
WinGet PrintSourceID, ID

hdd_frame := DllCall("GetDC", UInt, PrintSourceID)
hdc_frame := DllCall("GetDC", UInt, MagnifierID)

;#############   draw cross lines   ###########################################
DrawCross( M_C , R_C, zoom_c, dc )
  {
        ;specify the style, thickness and color of the cross lines
    h_pen := DllCall( "gdi32.dll\CreatePen", "int", 0, "int", 1, "uint", 0x0000FF)
        ;select the correct pen into DC
    DllCall( "gdi32.dll\SelectObject", "uint", dc, "uint", h_pen )         
        ;update the current position to specified point - 1st horizontal
    DllCall( "gdi32.dll\MoveToEx", "uint", dc, "int", M_C, "int", R_C, "uint", 0)
        ;draw a line from the current position up to, but not including, the specified point.
    DllCall( "gdi32.dll\LineTo", "uint", dc, "int", R_C, "int", R_C)
        ; 2nd horizontal
    DllCall( "gdi32.dll\MoveToEx", "uint", dc, "int", M_C, "int", R_C+zoom_c, "uint", 0)
    DllCall( "gdi32.dll\LineTo", "uint", dc, "int", R_C, "int", R_C+zoom_c)
        ; 3rd horizontal
    DllCall( "gdi32.dll\MoveToEx", "uint", dc, "int", R_C+zoom_c, "int", R_C, "uint", 0)
    DllCall( "gdi32.dll\LineTo", "uint", dc, "int", 2*R_C+zoom_c-M_C, "int", R_C)
        ; 4th horizontal
    DllCall( "gdi32.dll\MoveToEx", "uint", dc, "int", R_C+zoom_c, "int", R_C+zoom_c, "uint", 0)
    DllCall( "gdi32.dll\LineTo", "uint", dc, "int", 2*R_C+zoom_c-M_C, "int", R_C+zoom_c)       
        ; 1st vertical
    DllCall( "gdi32.dll\MoveToEx", "uint", dc, "int", R_C, "int", M_C, "uint", 0)
    DllCall( "gdi32.dll\LineTo", "uint", dc, "int", R_C, "int", R_C)
        ; 2nd vertical
    DllCall( "gdi32.dll\MoveToEx", "uint", dc, "int", R_C+zoom_c, "int", M_C, "uint", 0)
    DllCall( "gdi32.dll\LineTo", "uint", dc, "int", R_C+zoom_c, "int", R_C)
        ; 3rd vertical
    DllCall( "gdi32.dll\MoveToEx", "uint", dc, "int", R_C, "int", R_C+zoom_c, "uint", 0)
    DllCall( "gdi32.dll\LineTo", "uint", dc, "int", R_C, "int", 2*R_C+zoom_c-M_C)
        ; 4th vertical
    DllCall( "gdi32.dll\MoveToEx", "uint", dc, "int", R_C+zoom_c, "int", R_C+zoom_c, "uint", 0)
    DllCall( "gdi32.dll\LineTo", "uint", dc, "int", R_C+zoom_c, "int", 2*R_C+zoom_c-M_C)
}
SetTimer Repaint, 50   ; flow through

Repaint:
     MouseGetPos x, y
     xz := x-Rz
     yz := y-Rz

     DllCall("gdi32.dll\StretchBlt", UInt,hdc_frame, Int,0, Int,0, Int,2*R+zoom, Int,2*R+zoom
     , UInt,hdd_frame, UInt,xz, UInt,yz, Int,2*Rz+1, Int,2*Rz+1, UInt,0xCC0020) ; SRCCOPY
     
     DrawCross( LineMargin, R, zoom, hdc_frame )
     
     ; keep the frame outside the magnifier and precalculate wanted position
     If (x < (2*R+zoom+8) and y < (2*R+zoom+8))
           pos_new := (2*R+zoom+8)
     Else
           pos_new := 0

     if ( pos_old <> pos_new )          ; only move if the real position of window needs to change
        WinMove Magnifier,, ,pos_new
   
     pos_old := pos_new     ; store value for next loop
   
Return

#x::
     DllCall("gdi32.dll\DeleteDC", UInt,hdc_frame )
     DllCall("gdi32.dll\DeleteDC", UInt,hdd_frame )
   
ExitApp

#+::
^+WheelUp::                      ; Ctrl+Shift+WheelUp to zoom in
#-::
^+WheelDown::                    ; Ctrl+Shift+WheelUp to zoom out
    If (zoom < 31 and ( A_ThisHotKey = "^+WheelUp" or A_ThisHotKey ="#+") )
       zoom *= 1.189207115         ; sqrt(sqrt(2))
    If (zoom >  1 and ( A_ThisHotKey = "^+WheelDown" or A_ThisHotKey = "#-"))
       zoom /= 1.189207115
   
    part := halfside/zoom           ;new calculation of the magnified image
    Rz := Round(part)
    R := Rz*zoom
    Gui 2:Show, % "w" 2*R+zoom+3 " h" 2*R+zoom+3 " x0 y0", Magnifier
    TrayTip,,% "Zoom = " Round(100*zoom) "%"
   
Return

      ; Mouse slow down:
      ; The first parameter is always 0x71 (SPI_SETMOUSESPEED).
      ; The third parameter is the speed (range is 1-20, 10 is default).
F9::
   if  mouse_slow =
   {
      ; http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/base/getting_hardware_information.asp
      ; http://www.autohotkey.com/forum/topic5264.html

    DllCall("SystemParametersInfo", UInt, 0x70, UInt, 0, UIntP, mouse_speed_old, UInt, 0) ; important UintP (eg. return P(ointer) ?)
    TrayTip,, your old mousespeed was %mouse_speed_old% , setting to 3
    DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, UInt, 3, UInt, 0)
    mouse_slow = 1
   }
return

F9 up::
    DllCall("SystemParametersInfo", UInt, 0x71, UInt, 0, UInt, 10, UInt, 0)
    TrayTip,, restoring your mousespeed
    mouse_slow =
return

;Mouse move one step with arrow keys
#Up::MouseMove, 0, -1, 0, R

#Down::MouseMove, 0, 1, 0, R

#Left::MouseMove, -1, 0, 0, R

#Right::MouseMove, 1, 0, 0, R