Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* INSTRUCTIONS
- *
- * 1. Copy and paste this into notepad.
- * 2. Save the file as "LastClick.ahk" (name doesn't matter, extension does).
- * 3. If you have AHK installed, you should be able to double click the file to run it.
- *
- * Once the script is running, each time you click with the left mouse button
- * a Tray Tip will appear above the AHK icon on your toolbar, displaying the
- * time since you last clicked (Format is "minutes:seconds").
- *
- * To pause the script (prevent tooltip from displaying), right click on the AHK icon on
- * you toolbar and click "Suspend Hotkeys".
- * To close the scropt, right click on the AHK icon and click "Exit".
- */
- #CommentFlag, //
- lastTick := 0
- // Set hotkey as the Left mouse Button
- // The '~' ensures the native function of the key (clicking)
- // won't be blocked.
- ~LButton::
- // Find difference since last tick
- currentTick := A_TickCount
- t := currentTick - lastTick
- // First time used, so t is 0
- if (lastTick = 0)
- {
- t := 0
- }
- // Set last tick to this tick
- lastTick := currentTick
- // Convert ms to seconds
- tsec := Floor(t / 1000)
- tmin := 0
- if (tsec >= 60)
- {
- // Get how many minutes it's been
- tmin := Floor(tsec / 60)
- tsec := Mod(tsec , 60)
- }
- // Display a traytip displaying the time
- title := "Time since last click"
- msg := tmin . ":" . tsec
- TrayTip, %title%, %msg%, 5, 17
- Return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement