topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Thursday March 28, 2024, 9:28 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: AHK: multiple hotstrings  (Read 5339 times)

Armando

  • Charter Member
  • Joined in 2005
  • ***
  • Posts: 2,727
    • View Profile
    • Donate to Member
AHK: multiple hotstrings
« on: January 06, 2008, 07:21 PM »
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 :

: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!
« Last Edit: January 07, 2008, 03:49 AM by brotherS »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: AHK : multiple hotstrings
« Reply #1 on: January 06, 2008, 07:29 PM »
why not just repeat them twice, like this..

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

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Donate to Member
Re: AHK : multiple hotstrings
« Reply #2 on: January 06, 2008, 07:32 PM »
The following solution would solve it:

: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
    • View Profile
    • Donate to Member
Re: AHK : multiple hotstrings
« Reply #3 on: January 06, 2008, 07:56 PM »
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.

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,277
    • View Profile
    • Donate to Member
Re: AHK : multiple hotstrings
« Reply #4 on: January 06, 2008, 08:22 PM »
hehe.. at least jgpaiva understood the question better than me.. :)