 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
scooterpd
Joined: 15 Oct 2007 Posts: 11
|
Posted: Tue Oct 16, 2007 6:34 pm Post subject: spacebar as a hotkey trigger, plus more. |
|
|
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 |
|
 |
wOxxOm
Joined: 09 Feb 2006 Posts: 320
|
Posted: Tue Oct 16, 2007 7:58 pm Post subject: |
|
|
| 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 |
|
 |
Lexikos
Joined: 17 Oct 2006 Posts: 2739 Location: Australia, Qld
|
Posted: Wed Oct 17, 2007 6:52 am Post subject: |
|
|
This sounds like a job for Input!
| 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 |
 |
|
| Back to top |
|
 |
scooterpd
Joined: 15 Oct 2007 Posts: 11
|
Posted: Sun Oct 21, 2007 2:58 pm Post subject: |
|
|
thanks for the input, lexikos I got what I was looking for. and thank you too, wOxxOm. I appreciate the timely response. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|