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, 1:58 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 (In-Progress): Mouse Instructional Helper  (Read 8159 times)

Kraqule

  • Participant
  • Joined in 2008
  • *
  • default avatar
  • Posts: 3
    • View Profile
    • Donate to Member
IDEA (In-Progress): Mouse Instructional Helper
« on: February 08, 2008, 01:58 PM »
First off I must thank Skrommel for the help he has given me thus far. I have taken what he has given me and I have twisted it a little more to provide the product I desire.

1. The functionality I am still lacking in this script is the ability to have functioning animated gif's.

2. There is an issue I am having with displaying the updated action. The code seams to generate a white background one time and a transparent background the next.

This is meant to be a draggable alwaysontop window (Ctrl + Left Mouse Click to Move) that displays the mouse actions being performed on the system.

Here is my code and I have played with aniGIF.dll and control to little success. (My mind is still to small for it I guess.) Any ideas or input would be greatly welcomed.

;ShowMouse.ahk
; Shows mouse actions
;Skrommel @ 2008

#NoEnv
#Persistent,On
#SingleInstance,Force
SetBatchLines,-1
SetWinDelay,0
DetectHiddenWindows,On


size:=16       ;font size
posx:=300        ;screen x
posy:=300        ;screen y
hide:=5000     ;seconds
trans:=255     ;0-255

SysGet,dragx,68
SysGet,dragy,69
doubleClick:=DllCall("GetDoubleClickTime")

time:=A_TickCount

Gui,+Owner +AlwaysOnTop +E0x20 +Disable +Resize -SysMenu -MinimizeBox -MaximizeBox -Disabled -Caption -Border -ToolWindow +Background
WinSet,Transparent,0,ShowMouse
Gui,Margin,5,5
Gui,Font,s%size% w800
Gui,Color, white
Gui,Add,Text,+Center w200 vtextid, Instructors Helper
Gui,Add,Picture, w200 h200 vpicid,mouse.gif
Gui,Show,x%posx% y%posy% NoActivate, ShowMouse
Gui,+LastFound
guiid:=WinExist()
WinSet,Transparent,%trans%,ShowMouse %guiid%
SetTimer,HIDE,%hide%




~*LButton::
MouseGetPos,ldx,ldy
SHOW("Left Click")

  GetKeyState,state,RControl,U
  If state=D
{MouseGetPos,mx1,my1,mid
    WinGetTitle,stitle,ahk_id %mid%
    If stitle=ShowMouse
    {
      Loop
      {
        MouseGetPos,mx2,my2
        WinGetPos,sx,sy,,,ahk_id %mid%
        sx:=sx-mx1+mx2
        sy:=sy-my1+my2
        WinMove,ahk_id %mid%,,%sx%,%sy%     
        mx1:=mx2
        my1:=my2
        GetKeyState,mstate,LButton,P
        If mstate=U
          Break
      }
    }
}
Return


~*RButton::
MouseGetPos,rdx,rdy
SHOW("Right Click")
Return

~*LButton Up::
oldtime:=time
time:=A_TickCount
If (time-oldtime<doubleclick)
{
  SHOW("Double Click")
  Return
}
MouseGetPos,lux,luy
If (lux>ldx+dragx Or lux<ldx-dragx Or luy>ldy+dragy Or luy<ldy-dragy)
  SHOW("Left Drag")
;Else
;  SHOW("")
Return

~*RButton Up::
MouseGetPos,rux,ruy
If (rux>rdx+dragx Or rux<rdx-dragx Or ruy>rdy+dragy Or ruy<rdy-dragy)
  SHOW("Right Drag")
;Else
;  SHOW("")
Return

~*WheelUp::
SHOW("Scroll Up")
Return

~*WheelDown::
SHOW("Scroll Down")
Return


SHOW(text)
{
  Global guiid
  Global textid
  Global picid
  GuiControl,,textid,%text%
  GuiControl,,picid, %text%.gif
  WinShow,ahk_id %guiid%
  SetTimer,HIDE,%hide%
}


HIDE:
  SetTimer,HIDE,Off
  WinHide,ahk_id %guiid%
Return

The gifs are the animations that are to go with program to give a visual aid to those watching so they have an idea what is being performed with the mouse. A simple reminder that while Skrommel may have wrote the simple basic version I have played a fair bit and probably broke the entire set of coding rules in getting things to where I am close to realizing this project as finished.
« Last Edit: February 08, 2008, 03:00 PM by Kraqule »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,896
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: IDEA (In-Progress): Mouse Instructional Helper
« Reply #1 on: February 08, 2008, 02:02 PM »
very cool idea, please do keep us updated as you make progress with it.