Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

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

Login with username, password and session length
  • May 27, 2016, 03:09:24 PM
  • Proudly celebrating 10 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 2890 times)

Armando

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

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,258
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: AHK : multiple hotstrings
« Reply #1 on: January 06, 2008, 07:29:36 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
    • Read more about this member.
    • Donate to Member
Re: AHK : multiple hotstrings
« Reply #2 on: January 06, 2008, 07:32:19 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,717
    • View Profile
    • Donate to Member
Re: AHK : multiple hotstrings
« Reply #3 on: January 06, 2008, 07:56:23 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,258
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: AHK : multiple hotstrings
« Reply #4 on: January 06, 2008, 08:22:49 PM »
hehe.. at least jgpaiva understood the question better than me.. :)