mIRC Home    About    Download    Register    News    Help

Print Thread
#155803 09/08/06 02:17 PM
Joined: Nov 2003
Posts: 101
C
colt45 Offline OP
Vogon poet
OP Offline
Vogon poet
C
Joined: Nov 2003
Posts: 101
I was trying to think how to write this.

i.e. want to hold down CTRL and the mouse pointer turns to a hand pointer and when I clicked on a word (while holding down the CTRL) .. then it's echo something like - You have clicked on this word 'test'.

Can this be done? - any suggestion? (i've tried hotlink but couldn't really get it to work crazy)

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Code:
on ^*:hotlink:*:*:{
  if ($mouse.key & 2) {
    ;ctrl key pressed
    if ($mouse.key & 1) {
      ;left mouse click
      echo -st You have clicked on this word $+(',$1,')
    }
    return
  }
  halt
}


* there is the chance the mouse well not have turned to a pointy finger yet, if u pushed the ctrl key without moving the mouse and then clicked the mouse on a word with no mouse movement, but i would hazzard a guess thats what you want anyway. As soon as u move the mouse with ctrl down, it well show as a pointing finger.

Joined: Nov 2003
Posts: 101
C
colt45 Offline OP
Vogon poet
OP Offline
Vogon poet
C
Joined: Nov 2003
Posts: 101
PERFECT!

Many thanks - yea, does works.

Now I get the idea how it's works, will tweak few things now smile

Many thanks again.

Joined: Dec 2002
Posts: 204
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Dec 2002
Posts: 204
this is neat daveC...but was just wondering, what would someone need to do to change it from the 'CTRL' key to an F-Key? Like F9?


keek: Scots - intr.v. keeked, keekĀ·ing, keeks
To peek; peep.
Joined: Nov 2003
Posts: 101
C
colt45 Offline OP
Vogon poet
OP Offline
Vogon poet
C
Joined: Nov 2003
Posts: 101
Yea, or a [SHIFT] key? :P

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Shift, just change:

Code:
if ($mouse.key & 2) {


To:

Code:
if ($mouse.key & 4) {


As for Fkeys, you can't see if an fkey is held down in the on hotlink event, but you can catch an fkey being pressed by using an alias:

Code:
alias F1 ; F1 is hit
alias F2 ; F2 is hit
alias CF1 ; Control+F1
alias SF6 ; Shift+F6

Joined: Sep 2003
Posts: 4,230
D
Hoopy frood
Offline
Hoopy frood
D
Joined: Sep 2003
Posts: 4,230
Quote:
this is neat daveC...but was just wondering, what would someone need to do to change it from the 'CTRL' key to an F-Key? Like F9?


/help $mouse
1 left mouse, 2 ctrl, 4 shift, 8 alt, 16 right mouse

For F keys its a little harder, if it was a custom window there would be little problem as u can detect keys down and up, but for other windows i think that might be tougher, F9 is deteted down, but I dont think theres a resource to check to see if its down.

could try this
Code:
on ^*:hotlink:*:*:{
  if ($calc($ticks - %f9@ticks) < 50) {
    ;F9 pressed less 1/20th of a second ago!
    if ($mouse.key & 1) {
      ;left mouse click
      echo -st You have clicked on this word $+(',$1,') with F9 down
    }
    return
  }
  halt
}
alias f9 { set %f9@ticks $ticks }

* the idea is F9 being held down causes the F9 alias to be called over and over, on my system its always under 50ms, it was always 31,32,47 ms between occrances, (I have my repeat rate at the max).
So I simple set what time it goes off at, then see if its under 1/20th of a second since it was last tripped, and judge that as down.

Now if it was just a F9 press and release, I would argue that no one can be accurate enough to say if the F9 was down or not at the time the mouse was clicked, if its within 1/20th of a second. AKA Close enough to correct for a human operator.

Joined: Dec 2002
Posts: 204
K
Fjord artisan
Offline
Fjord artisan
K
Joined: Dec 2002
Posts: 204
this works great, thank you very much, i am using it to do a dictionary lookup on the words i clicked. i love it
grin


keek: Scots - intr.v. keeked, keekĀ·ing, keeks
To peek; peep.

Link Copied to Clipboard