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
  • September 01, 2015, 11:26:20 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: how do i.. with an alias?  (Read 2983 times)

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,218
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
how do i.. with an alias?
« on: April 26, 2007, 10:57:42 PM »
this should be easy for regex pros.. i have this alias here to eject removable drives and i want the semi-colon to be added automatically after the drive letter. e.g. if i type "eject e" --> "eject e:"; "eject e f" --> "eject e: f:" (minus quotes).. can someone give me a hand.. :)

Quote
RegEx Pattern: ^eject (.*)

EjectCD $$1 | "C:\Program Files\SysTools\EJECT.EXE" $$1

another type of alias that i'm looking for is to link a path with the keyword, say "games" then whenever i type "games <abc>", Farr will be searching <abc> in the path only.. something like the "cpanel" that is available right now..

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: how do i.. with an alias?
« Reply #1 on: April 27, 2007, 04:21:13 AM »
For the first one...
Code: [Select]
RegEx Pattern: ^eject (.*):?

EjectCD $$1 | "C:\Program Files\SysTools\EJECT.EXE" $$1:
(notice the ':' after '$$1')

As for the second part, see 'Keyword Modifiers' in the advanced section of the help file. ;)

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,218
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: how do i.. with an alias?
« Reply #2 on: April 27, 2007, 05:07:24 AM »
jgpaiva, sorry it doesn't seem to work.. see the screenshots..

Defining the alias
ws-eject-alias-1.png

and the result..
ws-eject-alias-2.png

as for the 2nd request, thanks for pointing in the correct direction.. :Thmbsup:
ws-keyword-1.png

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 34,976
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Donate to Member
Re: how do i.. with an alias?
« Reply #3 on: April 27, 2007, 05:34:37 AM »
actually jgpaiva's solution is basically correct -- you just need to update your alias result to SHOW YOU the : as well:

i.e. change
ejectCD $$1 | "C:\Program Files\SysTools\EJECT.EXE" $$1:

to
ejectCD $$1: | "C:\Program Files\SysTools\EJECT.EXE" $$1:


keep in mind this will not work on your example of "eject e f" since it will only add one : at the end of the f
but you could solve this by making another ejectcd alias which matches 2 drive letters and adds a : to both, but that would require a separate regular expression alias.

in this case, a better thing might be to launch a kind of batch file or script to invoke and do the replacement after the launch by this script. i urge people to use this kind of approach.


lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,218
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: how do i.. with an alias?
« Reply #4 on: April 27, 2007, 05:54:41 AM »
keep in mind this will not work on your example of "eject e f" since it will only add one : at the end of the f
but you could solve this by making another ejectcd alias which matches 2 drive letters and adds a : to both, but that would require a separate regular expression alias.

thanks for the explanation, mouser.. so, how do i go about the alias that matches two drive letters?

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: how do i.. with an alias?
« Reply #5 on: April 27, 2007, 06:12:28 AM »
This one should work.. ;)
Code: [Select]
RegEx Pattern: ^eject (.):? (.):?

EjectCD $$1: $$2: | "C:\Program Files\SysTools\EJECT.EXE" $$1: $$2:
(the ':?' is just so that you can still optionally put the ':' there)

[edit] corrected error with the pattern [/edit]
« Last Edit: April 27, 2007, 06:15:23 AM by jgpaiva »

lanux128

  • Global Moderator
  • Joined in 2005
  • *****
  • Posts: 6,218
    • View Profile
    • Coding Snacks by Lanux128
    • Donate to Member
Re: how do i.. with an alias?
« Reply #6 on: April 27, 2007, 06:22:55 AM »
thanks a lot, jgpaiva! :) now i can really work better with my removable drives :Thmbsup: