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 

Insert 6 zeros or 9 zeros with an m or b after a number

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
mpennington
Guest





PostPosted: Thu Mar 04, 2010 11:17 pm    Post subject: Insert 6 zeros or 9 zeros with an m or b after a number Reply with quote

I checked the faq and the userguide, searched the forums, but couldn't figure this out. I basically would like to be able to add six or nine zeroes any time that I use a number, don't space and put an "m" or a "b" (for millions or billions) after the number, then trigger it with space, enter or tab. I appreciate any help you can offer!
Back to top
jaco0646



Joined: 07 Oct 2006
Posts: 3113
Location: MN, USA

PostPosted: Thu Mar 04, 2010 11:30 pm    Post subject: Reply with quote

Sounds like a job for RegEx Powered Dynamic Hotstrings.
Back to top
View user's profile Send private message Visit poster's website
Byroboy



Joined: 13 Mar 2009
Posts: 16

PostPosted: Fri Mar 05, 2010 2:56 am    Post subject: Reply with quote

the most basic one would be
Code:
:?:m::
send,  000000
return

:?:b::
send, 000000000
return


personally I'd look at doing a ctrl + M or windows + M if someone doesn't put a way to detect previous char

Code:
#m:: ;<-- note the hash?
loop 2
{
Gosub tz
}
return

#b::
loop 3
{
Gosub tz
}
return

tz:
send, 000
return
;looping to save code as taught by my teachers :)
Back to top
View user's profile Send private message
tidbit



Joined: 09 Mar 2008
Posts: 1807
Location: Minnesota, USA

PostPosted: Fri Mar 05, 2010 4:07 am    Post subject: Reply with quote

Quote:
Code:

...
;looping to save code as taught by my teachers :)

you used 15 lines. (not counting blanks)
11 lines:
Code:
#m:: ;<-- note the hash?
loop 2
     Gosub tz
return

#b::
loop 3
     Gosub tz
return

tz:
     send, 000
return
6 lines:
Code:
#m:: ;<-- note the hash?
     send, 000000
return

#b::
     send, 000000000
return
2 lines:
Code:
#m:: send, 000000  ;<-- note the hash?
#b:: send, 000000000


ps: I would go with what jaco0646 said.
_________________
rawr. be very afraid
*poke*
Note: My name is all lowercase for a reason.
Even monkeys fall from trees. - Japanese proverb
Back to top
View user's profile Send private message
None



Joined: 28 Nov 2009
Posts: 3086

PostPosted: Fri Mar 05, 2010 4:16 am    Post subject: Reply with quote

I Had a lot of trouble getting this to work
I think this is the function you wanted
Code:
Top:
Input , New, L1 V,,1,2,3,4,5,6,7,8,9,0
Check:=Errorlevel
if (New="m") or (New="b")
  Goto CheckPrev
If (Check="Match")
  WasNum=1
Else 
  WasNum=0
Goto Top

CheckPrev:
If !WasNum
  Goto Top
If (New="m")
Send {Bs}000000
Else
Send {Bs}000000000
WasNum=0
Goto Top
Back to top
View user's profile Send private message
Byroboy



Joined: 13 Mar 2009
Posts: 16

PostPosted: Fri Mar 05, 2010 4:48 am    Post subject: Reply with quote

tidbit wrote:
Quote:
Code:

...
;looping to save code as taught by my teachers :)

you used 15 lines. (not counting blanks)
11 lines:
Code:
#m:: ;<-- note the hash?
loop 2
     Gosub tz
return

#b::
loop 3
     Gosub tz
return

tz:
     send, 000
return
6 lines:
Code:
#m:: ;<-- note the hash?
     send, 000000
return

#b::
     send, 000000000
return
2 lines:
Code:
#m:: send, 000000  ;<-- note the hash?
#b:: send, 000000000


ps: I would go with what jaco0646 said.



I know I did in this case, but when your making a big program it seriously helps!
Back to top
View user's profile Send private message
mpennington
Guest





PostPosted: Fri Mar 05, 2010 1:47 pm    Post subject: Thanks Reply with quote

Just wanted to say thanks to everybody for their input on this, I really appreciate it. I am now going to experiment with all the suggestions and hopefully get it running. Thanks again.
Back to top
mpennington
Guest





PostPosted: Fri Mar 05, 2010 1:58 pm    Post subject: You guys are good Reply with quote

That didn't take long, already got several of your solutions working, awesome time saver, thanks!!
Back to top
Display posts from previous:   
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