Welcome Guest.   Make a donation to an author on the site September 30, 2014, 10:57:06 AM  *

Please login or register.
Or did you miss your validation email?


Login with username and password (forgot your password?)
Why not become a lifetime supporting member of the site with a one-time donation of any amount? Your donation entitles you to a ton of additional benefits, including access to exclusive discounts and downloads, the ability to enter monthly free software drawings, and a single non-expiring license key for all of our programs.


You must sign up here before you can post and access some areas of the site. Registration is totally free and confidential.
 
Your Support Funds this Site: View the Supporter Yearbook.
   
   Forum Home   Thread Marks Chat! Downloads Search Login Register  
Pages: [1]   Go Down
  Reply  |  New Topic  |  Print  
Author Topic: Need help with optional parameters in aliases  (Read 5647 times)
diesalher
Participant
*
Posts: 5


View Profile Give some DonationCredits to this forum member
« on: April 22, 2009, 08:46:11 PM »

Hi, i'm trying FARR and i need a bit of help. First of all, sorry for my english, not my home lang.

Actually i'm trying to migrate from Launchy to FARR but, it's a bit more difficult than i though.
I mainly use Launchy for one thing, the Runny plugin.

I  use runny to invoke a program with a variable number of parameters so, in Launchy i simply type..

rtm [TAB] param1 [TAB] param2 [TAB] param3

and it invokes my program with the 0,1,2 or 3 parameters that i've typed
eJ C.\Program Files\rtm\rtm.exe param1 param2 param3

i think in farr this behavior is acomplished using alias with Regex but i'n no xpert in using Regex.

How can i acomplish the same behaviour? note that i could not enter parameters, or only 1 or 2 or the whole 3 .
I achieve to invoke the program with 3 params but no with 2 using a single regex..

anyway.is there any help with the expressions used in aliases?

thanks in advance.


Logged
mouser
First Author
Administrator
*****
Posts: 33,410



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #1 on: April 22, 2009, 09:00:58 PM »

you know i'm really embarrassed to say this, but farr should have a much easier way to pass arguments to programs.

as you say, you could do it by setting up an alias with a regular expression, but i think the solution, which has been discussed previously on the forum, is to define a universal separator character that someone can type to indicate that what follows is an arguement string to pass to whatever is being launched.

let me implement this today or tomorrow, and then we can debate about tweaks to what i implement, like what character we should use as the separator.

my inclination is to use something like:

normal search terms :: arg1 "arg two" arg3

so the :: means that whatever follows are commandline arguments.
the arguements are space separated, with double quotes enclosing single arguements that have spaces.

seem reasonable?
Logged
diesalher
Participant
*
Posts: 5


View Profile Give some DonationCredits to this forum member
« Reply #2 on: April 23, 2009, 03:30:41 AM »

Yes, seems very reasonable althogh i'm more inclined to use another separator like TAB
which never is user in a parameter, is only one keypress and helps me avoiding to use
"" which is a bit more usable in a NetBook.

So program [TAB] arg1a arg1b [TAB] arg2   --->   program "arg1 arg1b" arg2             Ultra fast to type

i suposse it should be nice if every user could choose his favorite separator.

Thank you very much
Logged
nitrix-ud
Charter Member
***
Posts: 482

View Profile Give some DonationCredits to this forum member
« Reply #3 on: April 23, 2009, 07:08:00 AM »

i still think the best would be a separate "box" for arguments or modifiers...
Logged
SlimShady
Supporting Member
**
Posts: 2

View Profile Give some DonationCredits to this forum member
« Reply #4 on: April 23, 2009, 07:24:20 AM »

I vote for the :: method. Seems fine. As long as you can type anything on the right side, it's great.
Logged
mouser
First Author
Administrator
*****
Posts: 33,410



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #5 on: April 24, 2009, 01:35:33 AM »

Implemented but not yet uploaded (i actually used ++ instead of :: because it's simpler to keep using + sign for modifiers).
For example:
[copy or print]
ping ++ www.donationcoder.com -n 2

Seems to work well and its LONG overdue.

I just have to test my recent variable replacement bugfix to make sure i didn't break anything before I upload.
Logged
mouser
First Author
Administrator
*****
Posts: 33,410



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #6 on: April 24, 2009, 01:36:50 AM »

Note1: you dont actually need the space AFTER the ++ but you do need it before the ++.
Note2: you can use this ++ method both on programs launched via explicit directory browsing, and on those contained within alias results.
Note3: ++ specified arguments will be ADDED to any existing arguments, so you can combine them.
Note4: An alias can even specify WHERE exactly in the argument list they should go by using %comlineargs% in the launch string.  This makes the ++ technique a very simple way of passing optional info to a non-regular expression alias.
Logged
mouser
First Author
Administrator
*****
Posts: 33,410



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #7 on: April 24, 2009, 04:33:51 AM »

new version is up, give it a try and let me know how it works for you.
Logged
diesalher
Participant
*
Posts: 5


View Profile Give some DonationCredits to this forum member
« Reply #8 on: April 24, 2009, 05:42:42 AM »

Seems to work fine  cheesy

Thank you very much for this update. Lightning fast.

NOTE:i still find the Launchy method to handle optional parameters faster and a bit more usable, but the low resources and no indexing of FARR is a winner. I think i can get used to use "", or maybe use autohotkey to do it for me smiley (in my netbook i hate use "" and i'm a bit fanatic of the minimum effort policy)
Logged
mouser
First Author
Administrator
*****
Posts: 33,410



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #9 on: April 24, 2009, 05:58:45 AM »

im open to other ways to handle arguments with spaces.. it's just that tab is out of the question since it's used differently in farr.

we could use an option that says that arguments are separated by some other character, and farr can auto quote args with spaces.

for example, we could have it so that if you type:

notepad ++ arg string 1 ++ arg string 2 ++ arg string 3

farr would pass that as

notepad "arg string 1" "arg string 2" "arg string 3"
Logged
diesalher
Participant
*
Posts: 5


View Profile Give some DonationCredits to this forum member
« Reply #10 on: April 24, 2009, 06:31:46 AM »

That'll be perfect, because then i could use AutohotKey to intercept the TABS (or another free key in my keyboard) and replace them with ++ when FARR is active. Anyway thanks again for your help, your support is impressive.
Logged
skajfes
Honorary Member
**
Posts: 204


View Profile Give some DonationCredits to this forum member
« Reply #11 on: April 24, 2009, 01:46:53 PM »

im open to other ways to handle arguments with spaces.. it's just that tab is out of the question since it's used differently in farr.

is tab doing anything that i am missing? it autocompletes the text, right? if it's all it does why couldn't it be like launchy? autocomplete plus a separator for the arguments?
Logged

It is impossible to make anything foolproof because fools are so ingenious.
mouser
First Author
Administrator
*****
Posts: 33,410



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #12 on: April 24, 2009, 10:41:21 PM »

Quote
is tab doing anything that i am missing? it autocompletes the text, right? if it's all it does why couldn't it be like launchy? autocomplete plus a separator for the arguments?

this could be done.. tab would autocomplete and then add the ++ for you automatically so you could put some optional commandline options.  certainly i could add an option for this at the very least.
Logged
skajfes
Honorary Member
**
Posts: 204


View Profile Give some DonationCredits to this forum member
« Reply #13 on: April 25, 2009, 03:09:41 AM »

this could be done.. tab would autocomplete and then add the ++ for you automatically so you could put some optional commandline options.  certainly i could add an option for this at the very least.
If that could be done, could a special character separator be used instead of the ++? something like ►, » or •? I am thinking that the user never has to type it, because we can use tab to autocomplete and add a separator, so why not use a character that is IMHO visually clearer?

I am thinking also if multiple parameters are needed you could just keep pressing tab to insert aditional separators. And I am not sure if this is needed in file browsing mode.....
« Last Edit: April 25, 2009, 03:15:38 AM by skajfes » Logged

It is impossible to make anything foolproof because fools are so ingenious.
diesalher
Participant
*
Posts: 5


View Profile Give some DonationCredits to this forum member
« Reply #14 on: April 27, 2009, 05:21:22 AM »

I've testing it more and i think i have a problem

I use this regular expression : ^rtm|gtd

I type rtm ++ arg1 ++ arg 2

the arg1 my program receives is "++ . arg1"

EDIT : My fault, i didn't realize that the ++ as parameter separator is not implemented in current release.
typing rtm ++ arg1 arg2 arg3 works fine.
« Last Edit: May 05, 2009, 04:56:09 AM by diesalher » Logged
kreatorr
Participant
*
Posts: 15

View Profile Give some DonationCredits to this forum member
« Reply #15 on: June 12, 2009, 11:23:12 PM »

Just discovered this undocumented feature with the recent release.  It's exactly what i've been looking for. 

Can this be further improved so that once ++ or whatever special character has been activated, the incremental search can kick in for the new parameters, i.e. file browsing mode to allow launching a program with a file as its parameter?
Logged
mouser
First Author
Administrator
*****
Posts: 33,410



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #16 on: June 12, 2009, 11:31:47 PM »

Quote
Can this be further improved so that once ++ or whatever special character has been activated, the incremental search can kick in for the new parameters, i.e. file browsing mode to allow launching a program with a file as its parameter?

can you elaborate?
Logged
kreatorr
Participant
*
Posts: 15

View Profile Give some DonationCredits to this forum member
« Reply #17 on: June 19, 2009, 04:48:31 AM »

Actually, I might be misunderstanding this feature, as it is about adding parameter values when calling up aliases.  I was confusing this with the proposed feature of handling objects and actions as covered in some previous discussions:

http://www.donationcoder....m/index.php?topic=11487.0
http://www.donationcoder....um/index.php?topic=2277.0
http://www.donationcoder....um/index.php?topic=3713.0

This would be a specific use-case where the 'action' is actually an implicit "Launch X, with Y as a parameter" when "X ++ Y" is entered.  For example, I'm trying to launch notepad with a file that is within FARR's search paths.  Ideally, I'd like to be able to type "no" and then have notepad appear on the list, type tab, to complete it, followed by "++".  Typing "myt" will then find a file called mytext.txt in the search paths.  Essentially after typing ++, it starts a new search based on what ever is typed after the "++".  Everything before the "++" is assumed to be a valid launch item (whether it be a path to an executable or an alias), and not included in the new search.  When that file shows up in the search list, type tab again if it's the first item to autocomplete resulting in something that looks like this in the FARR entry box :

C:\WINDOWS\system32\notepad.exe ++ C:\somesearchpath\mytext.txt

Hitting enter should then open notepad with mytext.txt as the parameter. 

Anyway, will look forward to mouser implementing the object -> action feature one day.  For now, being able to to launch items with parameters added on the fly is a good start! smiley
Logged
mouser
First Author
Administrator
*****
Posts: 33,410



see users location on a map View Profile WWW Read user's biography. Give some DonationCredits to this forum member
« Reply #18 on: June 19, 2009, 06:22:54 AM »

kreator, you've accurately described the situation -- and you are right that the object-action ideas would be what would let you do what you want if/when those are implemented.
Logged
Pages: [1]   Go Up
  Reply  |  New Topic  |  Print  
 
Jump to:  
   Forum Home   Thread Marks Chat! Downloads Search Login Register  

DonationCoder.com | About Us
DonationCoder.com Forum | Powered by SMF
[ Page time: 0.04s | Server load: 0.22 ]