AutoHotkey Community

It is currently May 25th, 2012, 7:59 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: October 16th, 2007, 7:34 pm 
Offline

Joined: October 15th, 2007, 5:09 pm
Posts: 11
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 16th, 2007, 8:58 pm 
Offline

Joined: February 9th, 2006, 8:36 pm
Posts: 338
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 17th, 2007, 7:52 am 
Offline

Joined: October 17th, 2006, 4:15 pm
Posts: 7501
Location: Australia
This sounds like a job for Input! :D
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

8)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 21st, 2007, 3:58 pm 
Offline

Joined: October 15th, 2007, 5:09 pm
Posts: 11
thanks for the input, lexikos :wink: I got what I was looking for. and thank you too, wOxxOm. I appreciate the timely response.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: engunneer, tomL, vsub, Yahoo [Bot] and 3 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group