DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: AHK: multiple hotstrings  (Read 7,461 times)

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • Coding Snacks
AHK: multiple hotstrings
« on: January 07, 2008, 01:21 AM »
I guess I could post that simple question in a specialized forum, but I know many here are AHK experts so...


I make an extensive use of AHK "auto-replace hotstring" (to expand abbreviations as I type them).

Now, I'd like to know how to have multiple potential hotstrings for the same string replacement.

Example. Let's say I have this line :

Code
:oc:parc2::tgsPÉtRe tgsPunié tgsPdoct tgsPThDo tgsPARC2 tgsPat tgsPthée

but I want to have more than one hotstring ("parc2" in that case) to trigger the string replacement "tgsPÉtRe tgsPunié tgsPdoct tgsPThDo tgsPARC2 tgsPat tgsPthée". (For example : I'd like to have "parc3" and "parc4" to trigger the same string replacement.)

What would be the proper syntax?

Thanks a lot!
"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould
« Last Edit: January 07, 2008, 09:49 AM by brotherS »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
Re: AHK : multiple hotstrings
« Reply #1 on: January 07, 2008, 01:29 AM »
why not just repeat them twice, like this..

Code
::parc3::tgsPÉtRe tgsPunié tgsPdoct tgsPThDo tgsPARC2 tgsPat tgsPthée
::parc4::tgsPÉtRe tgsPunié tgsPdoct tgsPThDo tgsPARC2 tgsPat tgsPthée

jgpaiva

  • Artificial Idiocy
  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • Cody Award
    • Participated in NANY Challenge Once
    • Coding Snacks
    • Portugal Inhabitant
    • Linux User
Re: AHK : multiple hotstrings
« Reply #2 on: January 07, 2008, 01:32 AM »
The following solution would solve it:

Code
:oc:parc1::
:oc:parc3::
:oc:parc2::
  send, tgsPÉtRe tgsPunié tgsPdoct tgsPThDo tgsPARC2 tgsPat tgsPthée
  return

(this way, all of them execute whatever comes after the :oc:parc2:: line, until they find a return)

[edit] damn, lanux beat me![/edit]

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • Coding Snacks
Re: AHK : multiple hotstrings
« Reply #3 on: January 07, 2008, 01:56 AM »
Ah! Thanks guys.

Lanux : That's what I was doing already, but I didn't want to paste the string repeatedly : it's not convenient when you make changes to the string.

jgpaiva : Exactly what I was trying to do.  :) The "send" command. Ok.
"I suppose it can be said that I'm an absent-minded driver. It's true that I've driven through a number of red lights on occasion, but on the other hand, I've stopped at a lot of green ones but never gotten credit for it."
Glenn Gould

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • Coding Snacks
    • Volunteers/Staff
    • Gathering Badge
    • Participated in NANY Challenge Once
    • Linux User
Re: AHK : multiple hotstrings
« Reply #4 on: January 07, 2008, 02:22 AM »
hehe.. at least jgpaiva understood the question better than me.. :)

Original address: https://www.donationcoder.com/forum/index.php?topic=11707.0