Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I do this, given that the number following w could be a variable length? does autohotkey hotstrings support regex or variable pattern matching?

I currenty have w expanding to width:px and the cursor positioned before the px.

:oR0:w::width:px;{left 3}

share|improve this question
Which platform and which app are you using? – jsejcksn Sep 9 '10 at 7:07
windows 7, autohotkey 1.0.48 – Moin Zaman Jan 10 '11 at 7:28
up vote 5 down vote accepted

Use the hotstrings( regexStr, expandedStr) method defined here and add this to the top of the script above the definition of the function:

 hotstrings( "w(\d+)\s", "width:%$1%px;" )

I've got it working on AutoHotKey on Windows XP.

share|improve this answer
That looks promising. I can't get it to work however. I pasted the contents hotstrings.ahk at the bottom of my existing script. Then I put the one line call you've got above at the top of my script. Nothing happens when I type w94 and hit space. – Moin Zaman Jan 10 '11 at 7:10
I think I am missing how to setup the hostrings, I'm finding some info about an .ini file but I don't have an autohotkey.ini file on my machine. Could you clarify how you've got it setup? – Moin Zaman Jan 10 '11 at 7:27
Ok, I got it. I created a new script called hotstrings.ahk with the function declaration at the bottom and my 1 line hostring definitions at the top. It works. Thanks again! – Moin Zaman Jan 10 '11 at 8:02
@Moin: Glad it worked for you! – yhw42 Jan 10 '11 at 15:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .