topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 8:45 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: IDEA: MouseLocater - automatic highlight cursor when mouse is moved again  (Read 19582 times)

rpnfan

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 7
    • View Profile
    • Donate to Member
Working on big and/or multiple screens one often has to search for the mouse cursor. For OS X there is a nice program called mouseLocater which is extremly helpful.

When you move the mouse the cursor is highlighted by a graphic, so it's much easier to find the current location of the cursor. This feature would be very annoying, when the mouselocator would show up every time you use the mouse. So you can define an "idle time" or "trigger delay". When the mouse was not moved for the specified time the mouselocater shows up, when you move the mouse then.

In addition you can specify how long the mouselocator graphic will show up. I know that there is a Windows feature using Ctrl-key (press and release) to show the mouse cursor. Of course I also know Skrommels MouseMark which is similar in function to the win feature. Both have the disadvantage that I must press a hotkey to enable the function. The win feature also conflicts with some autohotkey key combos I defined. So I mimicked the Win function by adapting Skrommels MouseMark to use the Press/Release Ctrl-key. But I'm still not happy with this solution.

I tried to code a similar tool like mouselocator with Autohotkey, but was not successfull so far :(

My dream would be that (similar to mouselocator) the graphic would blend after the specified time. In the Autohotkey script collection Activaid is a function called "VolumeControl" which slowly blends the graphic (in this case of the volume control) into the background -- similar to the OS X graphic if someone has seen this.

A nice touch would be the other option of the "original" MouseLocator program to allow to turn on the graphic always or to have a yellow dot to show clicks. The latter option can be useful when giving talks and demonstrating software. I used this sometimes on the Mac. Allowing to define a hotkey will make the script or program even more useful for this who do not which that the mouselocator shows up automatically.

The one coming up with the solution for this "autolocator" will be my hero :)

Best regards
Peter
« Last Edit: April 06, 2009, 02:34 PM by rpnfan »

rjbull

  • Charter Member
  • Joined in 2005
  • ***
  • default avatar
  • Posts: 3,199
    • View Profile
    • Donate to Member
I haven't tried this, but there's Sonar:
Sonar 4 (677Kb)
This package provides an expanded ring around the mouse pointer for users who have difficulty locating the pointer. Unlike the Windows XP version, this package places a permanent ring around the pointer. This version introduces the option to vary the colour of the Sonar ring.
June 2008 - Added the use of ALT+s to show / hide the ring when required, version now 4.1

rpnfan

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 7
    • View Profile
    • Donate to Member
I haven't tried this, but there's Sonar

Thanks for the pointer. I tried Sonar, but it will show a "sonar" circular or rectangular border around the cursor allways. This is very annoying. A ring showing up, just when "needed" is much better IMO. I have used "MouseLocator" on the Mac for a long time and I find this approach to be very nice -- especially with multi-monitor-setups.

BTW, one workaround would be to buy a Mac, install Parallels and run Windows inside OS X. Then you'll have MouseLocator still active ;)  I have tried this at work already.

Josh

  • Charter Honorary Member
  • Joined in 2005
  • ***
  • Points: 45
  • Posts: 3,411
    • View Profile
    • Donate to Member
What about the built in windows function which lets you tap CTRL and it highlights the cursor?

PhilB66

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,522
    • View Profile
    • Donate to Member

rpnfan

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 7
    • View Profile
    • Donate to Member
Josh and Phil,

thanks for the posts, but as I explained in my original posting I know both solutions you mentioned, but I'm looking for an automatic solution. Also the windows function will conflict with some autohotkeys I've defined.

I tried to write my own script, but was not successful. I find Autohotkey in some way easy to learn and on the other side there are some places where it's not consistent (%varname% for example).

Dormouse

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,952
    • View Profile
    • Donate to Member
Of course, you can use CircleDock to do this too. Again, it is a hotkey solution - but I set an otherwise redundant mouse button to exercise the hotkey and it then brings up the CircleDock. Very effective for operating CircleDock. To just locate the mouse though, it would take 2 clicks (one to bring it up and one to send it away)..

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Josh and Phil,

thanks for the posts, but as I explained in my original posting I know both solutions you mentioned, but I'm looking for an automatic solution. Also the windows function will conflict with some autohotkeys I've defined.

I tried to write my own script, but was not successful. I find Autohotkey in some way easy to learn and on the other side there are some places where it's not consistent (%varname% for example).

You may want to try it in AutoIt3

The syntax is easier and very close to Basic.  It has For While and Do loops and Select Case like basic.  Strings are double quoted and concatenated using the '&' operator.  It has combined operators like C++.  Variables are denoted with a dollar sign as first character.

$myName = "Miles"
$myName &= "Ahead" ; concatenation with assignment of result

The user defined library included has Timer functions and you can set handlers for Windows Messages, such as WM_MOUSEMOVE

You can use the Tooltip() function to show a ballon tip with optional icon at x,y coords, so it's easy to put it at the mouse cursor position.


Also if you download the Scite package it has Compile With Options so you can use custom icons for your executable and the Scite editor has syntax checking and automatic indenting with Tidy.  Also intelli-sense shows keywords and built in functions as you type.

I know what you mean about AutoHotKey.  You can do a lot in a few lines but sometimes I'd never be able to get a MsgBox to work if I didn't use the tool that creates it for me.  Mainly the frustration is wrapped around the fact that strings aren't usually double quoted. Every time I want to put a message that happens to have a keyword in it I feel like the thing is going to try to fire a function or something.  But it's learning curve.  :-\

« Last Edit: April 07, 2009, 01:06 PM by MilesAhead »

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member

Yes, yes, yes... AutoIt is better. No doubt. But instead of explaining a working script would've been fine.  :P


Anway, here's a quick and dirty Autohotkey Script using the freeware utility Sonar5.exe found at http://www.fxc.btinternet.co.uk. See attachment for script + Sonar5.exe.

If reactivated after no user input for 60 seconds, it'll show a mouse sonar for 5 seconds. (Lines 8 and 9). Feel free to enhance the script (like sonar only if mouse movement for 2 seconds, and so on. Anything is possible.).

Spoiler
;#NoTrayIcon
#persistent
#SingleInstance ignore


; in seconds

idle_seconds = 60
show_sonar = 5



; no more changes
; ----


SetTimer, Idle , 1000
Return


idle:
IfGreater, A_TimeIdle, %idle_seconds%000
{
   SetTimer, Idle, Off
   SetTimer, Active, 250
}
return

active:
If A_TimeIdle < 250
{
   settimer,active,off
   Run,sonar5.exe,,hide
   sleep,%show_sonar%000
   process,close,sonar5.exe
   settimer,idle
}
Return




kip

  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 40
    • View Profile
    • Fx Software
    • Donate to Member
Just try running Sonar5 and use CTRL-ALT+S to show/hide the sonar ring/square, it then hides in the system tray

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
Just try running Sonar5 and use CTRL-ALT+S to show/hide the sonar ring/square, it then hides in the system tray
Or just activate Microsoft's mouse sonar and press Control. But the idea is, to a.) show the mouse sonar without pressing a key and b.) go away after some seconds. Using Microsoft's mouse sonar in my script did not work out, as it won't display if the mouse moves.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
Yes, yes, yes... AutoIt is better. No doubt. But instead of explaining a working script would've been fine.  :P

The OP wanted or at least attempted to program it.  I provided some pointers in the right direction.  I don't see how doing it all for the person gets them there.

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
This is "Coding Snacks": Someone requests a program, another one codes it. It's not "Programming School".  The thread starter can learn from the source code and make it better.

I don't see how doing it all for the person gets them there.

That's where we disagree. I got interested in Autohotkey because years ago I requested a coding snack and Skrommel coded it for me. This was very helpful. I studied the source code, got interested in Autohotkey, started writing my own simple scripts and now do own tiny script applications with GUIs doing a lot of things. Telling me "Hey, use Autoit. It has For While and Do loops and Select Case like basic" back then would've been not helpful at all.

IMHO, if you want people to get interested in AutoIt, praising its benefits is nice, but posting applications ("See how easy it is done?") would be more effective.

MilesAhead

  • Supporting Member
  • Joined in 2009
  • **
  • Posts: 7,736
    • View Profile
    • Donate to Member
This is "Coding Snacks": Someone requests a program, another one codes it. It's not "Programming School".  The thread starter can learn from the source code and make it better.

I don't see how doing it all for the person gets them there.

That's where we disagree. I got interested in Autohotkey because years ago I requested a coding snack and Skrommel coded it for me. This was very helpful. I studied the source code, got interested in Autohotkey, started writing my own simple scripts and now do own tiny script applications with GUIs doing a lot of things. Telling me "Hey, use Autoit. It has For While and Do loops and Select Case like basic" back then would've been not helpful at all.

IMHO, if you want people to get interested in AutoIt, praising its benefits is nice, but posting applications ("See how easy it is done?") would be more effective.

I don't see how your approach of telling the OP to use a utility that doesn't fulfill the requirements is more helpful than mine.  If  you insist
on posting working code then please do so, instead of seeking to control others.

rpnfan

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 7
    • View Profile
    • Donate to Member
Just came home from work and found your post :)


Anway, here's a quick and dirty Autohotkey Script using the freeware utility Sonar5.exe found at http://www.fxc.btinternet.co.uk. See attachment for script + Sonar5.exe.

Thank you very much for the time to program the "Auto-Sonar" script. This basically works :-) It has some drawbacks -- for example pressing Win-key after the idleTime will also activate Sonar, also scrolling with the mouse will also activate the sonar and block scrolling for the "sonartime". I'll lock into the source to understand it and think/hope I can change it according to my wishes. The working example script will get me going :)

P.S.: Regarding my aim to post this wish. I want the program, and do not neccessarily want to work out a solution by myself. But of course I can not expect someone to write a solution, although I will be glad when someone does. I already tried to write this little program, but failed so far. I'm pretty busy at work and in the short time between with my family and kids, so even if I would like to spend more time on learning to use Autohotkey I'm here mostly interested in a working solution, where it doesn't matter that much to me where the solution comes from. I'm willing to invest my own time, but unfortunatelly time is limited and even if I would like to do many interesting and good things I can't do them all... :o  So I'm reallly grateful for your help you've given me here, as I have already spent quite some time to figure a solution out by myself :)

On an unrelated note. I've seen you're german speaking. I came up with a script for german keyboard users which is especially interesting if you touch-type ("blind maschineschreiben"). If you're interested you can test it. I came up with a new improved german keyboard layout which only _adds_ chars and functions to the keyboard but does not alter or remove the default ones. Extremly handy to speed up daily work in general and especially when coding or using special chars like []{}\ and so on often. I'm using it for over a year now with great success. I will be writing an article to introduce this keyboard layout, but before submitting the article to a computer magazine I'm looking for beta-testers if the article is good to understand and if the keyboard layout should be modified. My wish is that this keyboard layout is so good and general usable, that it can become some sort of standard as an improved german keyboard layout. Therefore I call it "DeutschlandPlus keyboard layout", because it just _adds_ functions and doesn't change any of the default keys on a german keyboard. So if somebody wants to test it or has an idea where to look for beta-testers I'm open to suggestions.

wr975

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 369
    • View Profile
    • Donate to Member
Hi, as told, it was just a quick hack. I've updated it a bit.

  • If you press SHIFT+WINDOWS+S it'll always show the mouse sonar until you press SHIFT+WINDOWS+S again.
  • If you press SHIFT+WINDOWS+1 you'll disable it.
  • If you press SHIFT+WINDOWS+2 you'll enable it.
  • After the idle time, it'll only show the mouse sonar if you moved the mouse 300 pixels (line 10). Pressing a key or using the scroll wheel won't activate it.

I guess that's most of your requests. :-)


Following requests...

> the graphic would blend after the specified time.
> to have a yellow dot to show clicks

are waaaaaaaaaay too difficult for me. Perhaps Skrommel or someone else adapts MouseLocator and implements all your requests.



I came up with a script for german keyboard users

Thanks for the offer, but I'm not really interested in learning a new keyboard layout. (Old dog, new tricks...) ;) I'm sure you can find some beta testers here: http://www.essential-freebies.de.


New source code:
Spoiler
;#NoTrayIcon
#persistent
#SingleInstance ignore


; in seconds

idle_seconds = 120
show_sonar = 5
mouse_offset = 300




; no more changes
; ----



SetTimer, Idle , 1000
Return



#+S::
settimer,active,off
settimer,idle,off

process,exist,sonar5.exe
if errorlevel <> 0
{
   process,close,sonar5.exe
   settimer, idle
}
else
   run,sonar5.exe
Return


#+1::
settimer,active,off
settimer,idle,off
process,close,sonar5.exe
msgbox,disabled
return


#+2::
process,close,sonar5.exe
settimer,active,off
settimer,idle
msgbox,enabled
return






idle:
IfGreater, A_TimeIdle, %idle_seconds%000
{
   ;ToolTip,Idle                     ; For testing
   SetTimer, Idle, Off
   MouseGetPos, MouseX, MouseY
   SchlafendeMaus := mousex + mousey
   SetTimer, Active, 250
}
return

active:
If A_TimeIdle < 250
{
   MouseGetPos, MouseX, MouseY
   AufgewachteMaus := mousex + mousey

   If schlafendemaus > %aufgewachtemaus%
      diff := schlafendemaus - aufgewachtemaus
   else
      diff := aufgewachtemaus - schlafendemaus
   if diff > %mouse_offset%
   {
      ;Tooltip               ; For testing
      settimer,active,off
      Run,sonar5.exe,,hide
      sleep,%show_sonar%000
      process,close,sonar5.exe
      settimer,idle
   }
}
Return

« Last Edit: April 08, 2009, 07:01 PM by wr975 »

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • View Profile
    • 1 Hour Software by skrommel
    • Donate to Member
 :) Try MovingMouse!

Helps locate the mouse when it's moved after being inactive for a while.

Just edit the waitfor, hideafter and tag to configure the settings.

Skrommel


;MovingMouse.ahk
; Helps locate the mouse when it's moved after being inactive for a while
;Skrommel @ 2009

waitfor=10            ;How many seconds to wait before tagging the mouse
hideafter=5           ;How many seconds to tag the mouse
tag=>> OVER HERE <<  ;Text to display next to the mouse

#SingleInstance,Force
#Persistent,On
#NoEnv
SetWorkingDir,%A_ScriptDir%

CoordMode,Mouse,Screen

SetTimer,MOVED,1000
inactive=0
Return


MOVED:
oldmx:=mx
oldmy:=my
MouseGetPos,mx,my
If (mx=oldmx And my=oldmy)
  inactive+=1
Else
{
  If (inactive>waitfor)
  {
    SetTimer,HIDE,% hideafter*1000
    SetTimer,SHOW,100
  }
  inactive=0
}
Return


SHOW:
  ToolTip,%tag%
Return


HIDE:
SetTimer,HIDE,Off
SetTimer,SHOW,Off
ToolTip,
Return

rpnfan

  • Participant
  • Joined in 2009
  • *
  • default avatar
  • Posts: 7
    • View Profile
    • Donate to Member
Hi wr975 and Skrommel,

thank you both for your great little programs. I was (still am a bit) ill -- so the longer delay in answering. I test both programs. I think wr975's solution is still sometimes generating wrong "sonars". I tried to hack both solutions, but none of my hacks was better in the end. Currently I'm using Skrommels solution, but will come back later to try to improve upon one of your solutions.

Thanks alot for your help!
Peter

Catherine Sea

  • Participant
  • Joined in 2008
  • *
  • Posts: 10
    • View Profile
    • Donate to Member