Jump to content


Photo

F2 to toggle, hold middle mouse button and shift


  • Please log in to reply
8 replies to this topic

#1 jaceguay

jaceguay
  • Members
  • 11 posts

Posted 22 June 2010 - 07:58 PM

Hi, I´ve try some toggle scripts but none work with mouse button, at least with my very basic autohotkey knowledge.
What i an trying to achieve is to press F2 to activate and hold the middle mouse button and shift key, and press F2 again to desactivate. I´m tryin to use sketchup on a VNC program and this command is for PAN.
If someone can help thanks in advance.

Edit: sorry for my english, just correcting some gramatical errors.

#2 BigVent

BigVent
  • Moderators
  • 194 posts

Posted 22 June 2010 - 08:14 PM

Here's a start... but you have to figure out the rest since you didn't provide any codez.

Good Luck!

~F1::
If (On!=1)
{
   msgbox, script started...MButton & Shift are being held... of course you have to figure out how...
   On = 1 
} 
Else
{
   msgbox, script stopped... MButton & Shift are now up... 
   On = 0
}
Return

Esc::ExitApp

ohh, btw... check out keylist & send in the help file.

#3 jaceguay

jaceguay
  • Members
  • 11 posts

Posted 22 June 2010 - 08:25 PM

Wow, Thanks for the fast reply, i use:

F2::Send % "{MButton " ((Cnt := !Cnt) ? "Down}" : "Up}" )

It keeps the Middle mouse button pressed until i press F2 again, but i can´t make it Middle mouse button and shift to be simuntaneous held until i press F2 again.

#4 jaceguay

jaceguay
  • Members
  • 11 posts

Posted 22 June 2010 - 08:45 PM

It works but it won´t release the buttons, I have to shut down autohotkey because the shift key keep pressed.

~F2::
If (On!=1)
{
Send, {shift Down}
MouseClick, Middle,,, 1, 0, D
   On = 1 
} 
Else
{
Send, {shift Up}
MouseClick, Middle,,, 1, 0, D
   On = 0
}
Return

Esc::ExitApp


#5 jaceguay

jaceguay
  • Members
  • 11 posts

Posted 23 June 2010 - 06:05 PM

I try to search the documentation section of the forum but still can´t do it, I´ve try
F2::Send % "+{MButton " ((Cnt := !Cnt) ? "Down}" : "Up}" )

Hopping that the + in front of MButton make the two keys been held, but only the MButton stick, and Shift is pressed only once.
Can someone help me, I want to Shift and Middle mouse button to be Held.

Sorry for my english.

Eu gostaria que o botão do meio do mouse e o shift ficassem pressionados até que eu apertasse novamente a tecla F2, infelizmente somente o botão do meio continua pressionado e o shift é ativado somente uma vez.
Se alguem tiver alguma idéia.
Obrigado : )

#6 jaceguay

jaceguay
  • Members
  • 11 posts

Posted 23 June 2010 - 07:17 PM

I´ve try:
F2::Send % "{Shift down}{MButton " ((Cnt := !Cnt) ? "Down}" : "Up}" )

but of course because of Shift down it won´t release shift after the second keypress, where could I put the Shift up to be released with MButton after I press F2 again?

#7 None

None
  • Members
  • 3199 posts

Posted 23 June 2010 - 07:27 PM

F2::Send % (Cnt := !Cnt) ? "{Shift Down}{MButton Down}" : "{Shift Up}{MButton Up}"
Or more spread out
F2::
If  (Cnt := !Cnt)
Send {Shift Down}{MButton Down}
Else
Send {Shift Up}{MButton Up}
Return


#8 jaceguay

jaceguay
  • Members
  • 11 posts

Posted 23 June 2010 - 07:42 PM

After I press F2 again the keys won´t release, I have to press shift and Middle mouse button to release each one.
Do you know what could be?
Thanks

#9 jaceguay

jaceguay
  • Members
  • 11 posts

Posted 24 June 2010 - 12:07 PM

I still can´t find the problem with the script, after a lot of research and test in two computers, just to be sure is noting wrong. Still the result is the same, and the second F2 press doesn't release the keys.
Actually I was thinking in a different approach, I have configured a shortcut inside sketchup for PAN to the "d" key, and have used the following:
F2::Send % "{d}{LButton " ((Cnt := !Cnt) ? "Down}" : "Up}" )
It is not the ideal way of doing it but it works, the {d} key change to the PAN command and the LButton is locked after that.
My problem now is that i need to insert a {Esc} command after I press F2 for the second time. This way it will return to the previous command active before I have pressed F2 for the first time, It mimics exactly the Shift and MButton behavior.
If anyone can help me, thanks.