AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

spacebar as a hotkey trigger, plus more.

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
scooterpd



Joined: 15 Oct 2007
Posts: 11

PostPosted: Tue Oct 16, 2007 6:34 pm    Post subject: spacebar as a hotkey trigger, plus more. Reply with quote

I want to know if it is possible to have spacebar as a hotkey trigger. furthermore, I would like to know if it's possible to do something like...
holding down the spacebar and pressing the "g" and the "m" keys consecutively, and then once I release the spacebar, it would result in my web browser opening up to www.gmail.com
that would be sweet.

the current code I use to auto-login to my gmail is...
Code:
+G::
Run, %A_ProgramFiles%\-MISC.-\Maxthon\Maxthon.exe  http://www.gmail.com, , Max
WinWaitActive, Maxthon Browser 
StatusBarWait, Done, , , Maxthon Browser   
Send, username{Tab}password{Enter}
Return

what I would like to do is replace the hotkey "+G"(shift G) with a hotkey that will allow me to hold spacebar down, then type g and m. I don't know if it can happen but that would be sweet.

thanks in advance
Back to top
View user's profile Send private message
wOxxOm



Joined: 09 Feb 2006
Posts: 320

PostPosted: Tue Oct 16, 2007 7:58 pm    Post subject: Reply with quote

Code:

isSpaceBarPressed=0
isActionDone=0
tickGpressed=0
tickSpacePressed=0
feedkey=
TIMESPAN:=200 ;ms

$Space::
   IfEqual,isSpaceBarPressed,1
   {
      send {SPACE}
      return
   }
   isSpaceBarPressed=1
   tickSpacePressed:=A_TickCount
   isActionDone=0
   return

Space up::
   isSpaceBarPressed=0
   ifEqual,isActionDone,0
      if( A_TickCount - tickSpacePressed < TIMESPAN)
         send {SPACE}
   return

$g::
   ifEqual,isSpaceBarPressed,1
   {
      tickGpressed:=A_TickCount
      ifNotEqual,feedkey,
      {
         send %feedkey%
         feedkey=
      }
      feedkey:=feedkey "g"
      SetTimer,FeedKeyBack,%TIMESPAN%
      return
  }
  send g
  return

$m::
   ifEqual,isSpaceBarPressed,1
      if( A_TickCount - tickGpressed < TIMESPAN)
      {
         SetTimer,FeedKeyBack,off
         tickGpressed=0
         feedkey=
         isActionDone=true
         Run,http://www.gmail.com
         return
      }
   tickGpressed=0
   send m
   return

FeedKeyBack:
   SetTimer,FeedKeyBack,off
   send %feedkey%
   feedkey=
   return
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Lexikos



Joined: 17 Oct 2006
Posts: 2739
Location: Australia, Qld

PostPosted: Wed Oct 17, 2007 6:52 am    Post subject: Reply with quote

This sounds like a job for Input! Very Happy
Code:
$Space::
    SpaceTick := A_TickCount
   
    ; Let user enter a command/text. Does not return
    Input, seq    ; until terminated by Space Up::
   
    if (A_TickCount-SpaceTick < 250 or seq="")
    {  ; So as to not interfere with quick typing, count this as having
        Send {Space}%seq%   ; released Space before entering %seq%.
        return
    }
    ; Show entered text.
    MsgBox %seq%
return
Space Up::Input ; end Input-in-progress

Cool
Back to top
View user's profile Send private message
scooterpd



Joined: 15 Oct 2007
Posts: 11

PostPosted: Sun Oct 21, 2007 2:58 pm    Post subject: Reply with quote

thanks for the input, lexikos Wink I got what I was looking for. and thank you too, wOxxOm. I appreciate the timely response.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group