Page 3 of 4

Re: Cursor Highlighter

Posted: 16 Dec 2021, 18:41
by lblb
@likethevegetable

How are you trying to trigger it from another script? Using a hotkey? Using a GUI button?

Re: Cursor Highlighter

Posted: 16 Dec 2021, 19:48
by likethevegetable
@lblb: This would be through a launcher/run gui | made--I type "mou" and it sends the input. Note that I've used this paradigm for many, many other hotkeys that I don't care to remember, and all works fine. I figured input level might be at play.

it actually turns out the ctrl+alt+m (^!m) works, but windows+shift+m doesn't, strange. I ultimately made the hotkey ctrl+alt+win+m and it works.

Re: Cursor Highlighter

Posted: 16 Dec 2021, 23:33
by lblb
@likethevegetable

I'm glad you found a solution to your problem!

Re: Cursor Highlighter

Posted: 17 Jan 2022, 05:55
by MouseTrap
I like this script very much and it is really helpful.

Sometimes I would like to have one or two movable arrow or hand picutures which are not following the mouse (as in this script) but can be moved with the mouse (click and move). Such that I can put it somewhere on the screen to highlight some aspects there while sharing the screen in a webmeeting.

Can this be done with this script or with an other script?

Re: Cursor Highlighter

Posted: 18 Jan 2022, 21:35
by lblb
@MouseTrap

I'm glad you like my little script.

Unfortunately, what you suggest is not possible with this script. But I'll keep your suggestion in my files for a future update. In the meantime, maybe you could use something like the free program "Epic Pen" to annotate your screen and add arrows. It's pretty awesome.

Re: Cursor Highlighter

Posted: 23 Jan 2022, 11:08
by amateur+
My five y.o. son uses this one with your script :)
Spoiler

Re: Cursor Highlighter

Posted: 23 Jan 2022, 18:06
by lblb
@amateur+

Haha! That's cute!

Re: Cursor Highlighter

Posted: 23 Jan 2022, 20:09
by Hellbent
Scalable, with left click indicator.
Animation.gif
Animation.gif (632.29 KiB) Viewed 3457 times

Code: Select all

;***************************************************************************************************
#Include, <My Altered GDIP LIB>  ;GDIP.ahk
;***************************************************************************************************
#SingleInstance force
CoordMode, Mouse, screen
SetBatchLines, -1
GDIP_StartUp()

ScaleFactor := 1
MouseGetPos, x, y
global Gui1 := New PopUpWindow( { AutoShow: 1 , X: x - 65 * ScaleFactor , Y:  y - 12 * ScaleFactor , W: 130 * ScaleFactor, H: 60 * ScaleFactor , Options: " -DPIScale +AlwaysOnTop Toolwindow E0x20" } )

;~ Gui1.ProgressColor := "FF0000" 		;RED
;~ Gui1.ProgressColor := "FFFF00"		;YELLOW
Gui1.ProgressColor := "00FF00"		;GREEN
;~ Gui1.ProgressColor := "00FFFF"		;AQUA
;~ Gui1.ProgressColor := "0000FF"		;BLUE
;~ Gui1.ProgressColor := "FF00FF"			;PURPLE

Gui1.DrawBitmap( HB_BITMAP_MAKER( ScaleFactor ) , { X: 0 , Y: 0 , W: Gui1.W , H: Gui1.H } , dispose := 1 , 1 )
SetTimer, WatchCursor, 10
Gui1.Count := 0
return
*ESC::ExitApp

;~ RAlt::PopUpWindow.Helper()

WatchCursor:
	MouseGetPos, x, y 
	if( x != lx || y != ly ){
		Gui1.UpdateSettings( { X: x - 65 * ScaleFactor , Y: y - 12 * ScaleFactor } )
		Gui1.ShowWindow()
		lx := x , ly := y
	}
	return

~LButton::
	SetTimer, CountDownAnimation, Off
	sleep, 10
	Gui1.Count := 180
	Gui1.ClearWindow()
	Gui1.DrawBitmap( HB_BITMAP_MAKER( ScaleFactor ) , { X: 0 , Y: 0 , W: Gui1.W , H: Gui1.H } , dispose := 1 , 1 )
	return
	
~LButton Up::
	SetTimer, CountDownAnimation, 30
	return

CountDownAnimation:
	if( !Gui1.Count -= 10 )
		SetTimer, CountDownAnimation, Off
	Gui1.ClearWindow()
	Gui1.DrawBitmap( HB_BITMAP_MAKER( ScaleFactor ) , { X: 0 , Y: 0 , W: Gui1.W , H: Gui1.H } , dispose := 1 , 1 )
	return

HB_BITMAP_MAKER( ScaleFactor := 1 ){
	;Bitmap Created Using: HB Bitmap Maker
	pBitmap := Gdip_CreateBitmap( 130 * ScaleFactor , 60 * ScaleFactor ) , G := Gdip_GraphicsFromImage( pBitmap ) , Gdip_SetSmoothingMode( G , 2 )
	Brush := Gdip_CreateLineBrushFromRect( 6 * ScaleFactor , 7 * ScaleFactor , 124 * ScaleFactor , 48 * ScaleFactor , "0x00000000" , "0x33000000" , 1 , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 11 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawArc( G , Pen , 10 * ScaleFactor , -30 * ScaleFactor , 110 * ScaleFactor , 80 * ScaleFactor , 0 , 180 ) , Gdip_DeletePen( Pen )
	Pen := Gdip_CreatePen( "0x99000000" , 7 ) , Gdip_DrawArc( G , Pen , 10 * ScaleFactor , -30 * ScaleFactor , 110 * ScaleFactor , 80 * ScaleFactor , 0 , 180 ) , Gdip_DeletePen( Pen )
	Brush := Gdip_CreateLineBrush( 6 * ScaleFactor , 46 * ScaleFactor , 127 * ScaleFactor , 83 * ScaleFactor , "0x33" Gui1.ProgressColor , "0xff" Gui1.ProgressColor , 1 ) , Pen := Gdip_CreatePenFromBrush( Brush , 5 ) , Gdip_DeleteBrush( Brush ) , Gdip_DrawArc( G , Pen , 10 * ScaleFactor , -30 * ScaleFactor , 110 * ScaleFactor , 80 * ScaleFactor , -180 , -Gui1.Count ) , Gdip_DeletePen( Pen )
	Brush := Gdip_BrushCreateSolid( "0xFF" Gui1.ProgressColor ) , Gdip_FillEllipse( G , Brush , 62 * ScaleFactor , 9 * ScaleFactor , 6 * ScaleFactor , 6 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Brush := Gdip_BrushCreateSolid( "0xFF000000" ) , Gdip_FillEllipse( G , Brush , 63 * ScaleFactor , 10 * ScaleFactor , 4 * ScaleFactor , 4 * ScaleFactor ) , Gdip_DeleteBrush( Brush )
	Gdip_DeleteGraphics( G )
	return pBitmap
}

;####################################################################################################################################################################################
;####################################################################################################################################################################################
;####################################################################################################################################################################################
;####################################################################################################################################################################################
class PopUpWindow	{
;PopUpWindow v2
;Date Written: Oct 28th, 2021
;Written By: Hellbent aka CivReborn
;SpcThanks: teadrinker , malcev 
	static Index := 0 , Windows := [] , Handles := [] , EditHwnd , HelperHwnd
	__New( obj := "" ){
		This._SetDefaults()
		This.UpdateSettings( obj )
		This._CreateWindow()
		This._CreateWindowGraphics()
		if( This.AutoShow )
			This.ShowWindow( This.Title )
	}
	_SetDefaults(){
		This.X := 10
		This.Y := 10
		This.W := 10
		This.H := 10
		This.Smoothing := 2
		This.Options := " -DPIScale +AlwaysOnTop "
		This.AutoShow := 0
		This.GdipStartUp := 0
		This.Title := ""
		
		This.Controls := []
		This.Handles := []
		This.Index := 0 
	}
	AddTrigger( obj ){
		local k , v , cc , bd
		
		This.Controls[ ++This.Index ] := { 	X:		10
										,	Y:		10
										,	W:		10
										,	H:		10	}
		for k, v in obj
			This.Controls[ This.Index ][ k ] := obj[ k ] 
		cc := This.Controls[ This.Index ]
		Gui, % This.Hwnd ":Add", Text, % "x" cc.X " y" cc.Y " w" cc.W " h" cc.H " hwndhwnd"
		This.Handles[ hwnd ] := This.Index
		This.Controls[ This.Index ].Hwnd := hwnd
		return hwnd
		
	}
	DrawTriggers( color := "0xFFFF0000" , AutoUpdate := 0 ){
		local brush , cc 
		Brush := Gdip_BrushCreateSolid( color ) 
		Gdip_SetSmoothingMode( This.G , 3 )
		loop, % This.Controls.Length()	{
			cc := This.Controls[ A_Index ]
			Gdip_FillRectangle( This.G , Brush , cc.x , cc.y , cc.w , cc.h )
		
		}
		Gdip_DeleteBrush( Brush )
		Gdip_SetSmoothingMode( This.G , This.Smoothing )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	UpdateSettings( obj := "" , UpdateGraphics := 0 ){
		local k , v
		if( IsObject( obj ) )
			for k, v in obj
				This[ k ] := obj[ k ]
		( This.X = "Center" ) ? ( This.X := ( A_ScreenWidth - This.W ) / 2 ) 	
		( This.Y = "Center" ) ? ( This.Y := ( A_ScreenHeight - This.H ) / 2 ) 	
		if( UpdateGraphics ){
			This._DestroyWindowsGraphics()
			This._CreateWindowGraphics()
		}
	}
	_CreateWindow(){
		local hwnd
		Gui , New, % " +LastFound +E0x80000 hwndhwnd -Caption  " This.Options
		PopUpWindow.Index++
		This.Index := PopUpWindow.Index
		PopUpWindow.Windows[ PopUpWindow.Index ] := This
		This.Hwnd := hwnd
		PopUpWindow.Handles[ hwnd ] := PopUpWindow.Index
		if( This.GdipStartUp && !PopUpWindow.pToken )
			PopUpWindow.pToken := GDIP_STARTUP()
	}
	_DestroyWindowsGraphics(){
		SelectObject( This.hdc , This.obm )
		DeleteObject( This.hbm )
		DeleteDC( This.hdc )
	}
	_CreateWindowGraphics(){
		This.hbm := CreateDIBSection( This.W , This.H )
		This.hdc := CreateCompatibleDC()
		This.obm := SelectObject( This.hdc , This.hbm )
		This.G := Gdip_GraphicsFromHDC( This.hdc )
		Gdip_SetSmoothingMode( This.G , This.Smoothing )
	}
	ShowWindow( Title := "" ){
		Gui , % This.Hwnd ":Show", % "x" This.X " y" This.Y " w" This.W " h" This.H " NA", % Title
	}
	HideWindow(){
		Gui , % This.Hwnd ":Hide",
	}
	UpdateWindow(){
		UpdateLayeredWindow( This.hwnd , This.hdc , This.X , This.Y , This.W , This.H )
	}
	ClearWindow( AutoUpdate := 0 ){
		Gdip_GraphicsClear( This.G )
		if( Autoupdate )
			This.UpdateWindow()
	}
	DrawBitmap( pBitmap , obj , dispose := 1 , AutoUpdate := 0 ){
		Gdip_DrawImage( This.G , pBitmap , obj.X , obj.Y , obj.W , obj.H )
		if( dispose )
			Gdip_DisposeImage( pBitmap )
		if( Autoupdate )
			This.UpdateWindow()
	}
	PaintBackground( color := "0xFF000000" , AutoUpdate := 0 ){
		if( isObject( color ) ){
			Brush := Gdip_BrushCreateSolid( ( color.HasKey( "Color" ) ) ? ( color.Color ) : ( "0xFF000000" ) ) 
			if( color.Haskey( "Round" ) )
				Gdip_FillRoundedRectangle( This.G , Brush , color.X , color.Y , color.W , color.H , color.Round )
			else
				Gdip_FillRectangle( This.G , Brush , color.X , color.Y , color.W , color.H ) 
		}else{
			Brush := Gdip_BrushCreateSolid( color ) 
			Gdip_FillRectangle( This.G , Brush , -1 , -1 , This.W + 2 , This.H + 2 ) 
		}
		Gdip_DeleteBrush( Brush )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	DeleteWindow( GDIPShutdown := 0 ){
		Gui, % This.Hwnd ":Destroy"
		SelectObject( This.hdc , This.obm )
		DeleteObject( This.hbm )
		DeleteDC( This.hdc )
		Gdip_DeleteGraphics( This.G )
		hwnd := This.Hwnd
		for k, v in PopUpWindow.Windows[ Hwnd ]
			This[k] := ""
		PopUpWindow.Windows[ Hwnd ] := ""
		if( GDIPShutdown ){
			Gdip_Shutdown( PopUpWindow.pToken )
			PopUpWindow.pToken := ""
		}
	}
	_OnClose( wParam ){
		if( wParam = 0xF060 ){	;SC_CLOSE ;[ clicking on the gui close button ]
			Try{
				Gui, % PopUpWindow.HelperHwnd ":Destroy"
				SoundBeep, 555
			}
		}
	}
	CreateCachedBitmap( pBitmap , Dispose := 0 ){
		local pCachedBitmap
		if( This.CachedBitmap )
			This.DisposeCachedbitmap()
		DllCall( "gdiplus\GdipCreateCachedBitmap" , "Ptr" , pBitmap , "Ptr" , this.G , "PtrP" , pCachedBitmap )
		This.CachedBitmap := pCachedBitmap
		if( Dispose )
			Gdip_DisposeImage( pBitmap )
	}
	DrawCachedBitmap( AutoUpdate := 0 ){
		DllCall( "gdiplus\GdipDrawCachedBitmap" , "Ptr" , this.G , "Ptr" , This.CachedBitmap , "Int" , 0 , "Int" , 0 )
		if( AutoUpdate )
			This.UpdateWindow()
	}
	DisposeCachedbitmap(){
		DllCall( "gdiplus\GdipDeleteCachedBitmap" , "Ptr" , This.CachedBitmap )
	}
	Helper(){
		local hwnd , MethodList := ["__New","UpdateSettings","ShowWindow","HideWindow","UpdateWindow","ClearWindow","DrawBitmap","PaintBackground","DeleteWindow" , "AddTrigger" , "DrawTriggers", "CreateCachedBitmap" , "DrawCachedBitmap" , "DisposeCachedbitmap" ]
		Gui, New, +AlwaysOnTop +ToolWindow +HwndHwnd
		PopUpWindow.HelperHwnd := hwnd
		Gui, Add, Edit, xm ym w250 r1 Center hwndhwnd, Gui1
		PopUpWindow.EditHwnd := hwnd
		loop, % MethodList.Length()	
			Gui, Add, Button, xm y+1 w250 r1 gPopUpWindow._HelperClip, % MethodList[ A_Index ]
		Gui, Show,,
		OnMessage( 0x112 , This._OnClose.Bind( hwnd ) )
	}
	_HelperClip(){
		local ClipList 
		
		GuiControlGet, out, % PopUpWindow.HelperHwnd ":", % PopUpWindow.EditHwnd	
		
		ClipList := 		{ 	__New: 					" := New PopUpWindow( { X: 0 , Y: 0 , W: A_ScreenWidth , H: A_ScreenHeight , Options: "" -DPIScale +AlwaysOnTop "" } )"
							,	UpdateSettings:			".UpdateSettings( { X: """" , Y: """" , W: """" , H: """" } , UpdateGraphics := 0 )"
							,	ShowWindow:				".ShowWindow( Title := """" )"
							,	HideWindow:				".HideWindow()"
							,	UpdateWindow:			".UpdateWindow()"
							,	ClearWindow:			".ClearWindow( AutoUpdate := 0 )"
							,	DrawBitmap:				".DrawBitmap( pBitmap := """" , { X: 0 , Y: 0 , W: " Out ".W , H: " Out ".H } , dispose := 1 )"
							,	PaintBackground:		".PaintBackground( color := ""0xFF000000"" )  "  ";{ Color: ""0xFF000000"" , X: 2 , Y: 2 , W: " Out ".W - 4 , H: " Out ".H - 4 , Round: 10 }"
							,	DeleteWindow:			".DeleteWindow( GDIPShutdown := 0 )"
							,	AddTrigger:				".AddTrigger( { X: """" , Y: """" , W: """" , H: """" , Value: """" , Label: """" , BoundClass: """" , BoundMethod: """" } )"	
							,	DrawTriggers:			".DrawTriggers( color := ""0xFFFF0000"" , AutoUpdate := 0 )"	
							,	CreateCachedBitmap:		".CreateCachedBitmap( pBitmap , Dispose := 0 )"	
							,	DrawCachedBitmap: 		".DrawCachedBitmap( AutoUpdate := 0 )"	
							,	DisposeCachedbitmap:	".DisposeCachedbitmap()"	}
							
		clipboard := Out ClipList[ A_GuiControl ]
		
	}
}

Re: Cursor Highlighter

Posted: 25 Jan 2022, 03:35
by lblb
@Hellbent

Nice, thanks for the script!

Re: Cursor Highlighter

Posted: 07 Feb 2022, 09:35
by MouseTrap
MouseTrap wrote:
17 Jan 2022, 05:55
Sometimes I would like to have one or two movable arrow or hand picutures which are not following the mouse (as in this script) but can be moved with the mouse (click and move). Such that I can put it somewhere on the screen to highlight some aspects there while sharing the screen in a webmeeting.
Could this be done by pausing the position update of the picture following the mouse?
So I could move my mouse to the desired place, press on pause and the picture stays there until I press pause again and the picture is following the mouse?

Re: Cursor Highlighter

Posted: 07 Feb 2022, 09:53
by LAPIII
@Hellbent, how can I get your altered GDIP lib? I have GDI+ lib by Tic.

Re: Cursor Highlighter

Posted: 07 Feb 2022, 12:23
by Hellbent
LAPIII wrote:
07 Feb 2022, 09:53
@Hellbent, how can I get your altered GDIP lib? I have GDI+ lib by Tic.
It's the same lib.

Re: Cursor Highlighter

Posted: 07 Feb 2022, 15:56
by LAPIII
@Hellbent, I used this file in my user library: Gdip_All.ahk . Why did I get:

Image

My script Is on the desktop.

Re: Cursor Highlighter

Posted: 07 Feb 2022, 16:18
by amateur+
@LAPIII, I don't see your image:
Spoiler
But maybe you need this:

Code: Select all

#Include, <Gdip_All>

Re: Cursor Highlighter

Posted: 07 Feb 2022, 17:13
by Hellbent
LAPIII wrote:
07 Feb 2022, 15:56
@Hellbent, I used this file in my user library: Gdip_All.ahk . Why did I get:

Image

My script Is on the desktop.
I can only say that this

Code: Select all

#Include <My Altered GDIP LIB>
is because I have a ahk file with that name in my documents\autohotkey\Lib folder . If it was somewhere else I would just use the full path.

Re: Cursor Highlighter

Posted: 26 Aug 2022, 10:23
by nyfer
Instead of a halo around cursor, i just need a circle, can anybody please help me. am new to ahk

Re: Cursor Highlighter

Posted: 26 Aug 2022, 10:30
by LAPIII
What do you mean? You mean you want a circle for a cursor? Please explain!

Re: Cursor Highlighter

Posted: 26 Aug 2022, 10:51
by nyfer

Re: Cursor Highlighter

Posted: 26 Aug 2022, 14:42
by nyfer

Code: Select all

Gui, 1:+AlwaysOnTop -Caption +LastFound -SysMenu +ToolWindow -DPIScale +E0x20
Gui, 1:Color, F0F0F0
Gui, 1:Font, s100 cYellow
Gui, 1:Add, Text, x20 y15,% CHR(0x25EF)
;Setting x and y of Unicode circle with full circle of Gui 2
Gui, 1:Show, w200 h200
WinSet, TransColor, F0F0F0
something like this. I got this code snipet from viewtopic.php?style=7&t=104004&p=461914

Re: Cursor Highlighter

Posted: 26 Aug 2022, 16:00
by LAPIII
Check here and watch the video. :)