AutoHotkey Community

It is currently May 27th, 2012, 12:13 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 4 posts ] 
Author Message
PostPosted: May 20th, 2011, 4:22 am 
Offline

Joined: May 20th, 2011, 4:15 am
Posts: 6
I want to get all 10 digit numbers typed to have dashes added to phone number format.
########## to ###-###-####

I want this for any 10 numbers typed consecutively not just one specific number.
I also want it to be instant without having to select the number or using a hotkey to trigger it if possible. Similar to this code where typing pat is instantly replaced by Patrick:
Code:
:*:pat::Patrick


Thanks in advance. I searched for a long while but couldn't find this exact thing and am not savvy enough to figure it out by myself.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2011, 4:59 am 
Offline

Joined: November 28th, 2009, 4:45 am
Posts: 3089
Code:
Var:="a"
Loop {
Input, Key, L1 V
Var:=SubStr(Var,-8) . Key ;limit var to last ten characters typed
If RegExMatch(Var,"\D") ;if var contains any non digits
 Continue
Send {Bs 10}
Send % SubStr(Var,1,3) "-" SubStr(Var,4,3) "-" SubStr(Var,7)
Var:="a"
}
~LButton:: ;if any of these keys are used make the var equal to a letter
~RButton::
~Bs::
~Left::
~Right::
~Up::
~Down::
Var:="a"
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2011, 5:08 am 
Offline

Joined: April 8th, 2009, 8:23 pm
Posts: 3036
Location: Rio de Janeiro - RJ - Brasil
Related: RegEx Powered Dynamic Hotstrings

_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"
Image
Antonio França
My stuff: Google Profile


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 20th, 2011, 5:12 am 
Offline

Joined: May 20th, 2011, 4:15 am
Posts: 6
Thank you very very much
:D


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: Google Feedfetcher, Yahoo [Bot] and 13 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