Page 1 of 1

Alias Arguments

Posted: 03 May 2013 19:28
by CookieMonster
I know how to create an Alias, what I don't understand is Alias Arguments, why you would use them, it's a little confusing to me. All they seem to do is print a string when I use one of the examples in the documentation, I hope someone can give me more in-depth info I'm not understanding within the documentation.

Re: Alias Arguments

Posted: 05 May 2013 12:56
by FluxTorpedoe
Hi'
Arguments are the element(s) you write after the alias name.
They're useful with scripting where your Alias runs a command and the arguments are the values. e.g.

• Alias Definition:
MyAlias=::command <@1>;
• In Address Bar:
@MyAlias Argument


Well, examples are better than words. (#2 and #3 are very useful! 8) )

Let's say you've a folder full of files:
Name_01.jpg
Name_02.jpg
...
Name_66.jpg


---------

Example #1 - Alias Definition:

Code: Select all

msg=::msg "Hello Mr <@1>";
Typing in AddressBar:
@msg Toto
:arrow: Will pop up the message: "Hello Mr Toto"

---------

Example #2 - Alias Definition:

Code: Select all

sel=::selfilter "<@1>"; focus "L";
Typing in AddressBar:
@sel _0
:arrow: Will instantly select files from _01 to _09:
Name_01.jpg
Name_02.jpg
...
Name_09.jpg


---------

Example #3 - Alias Definition:

Code: Select all

ren=::rename s, '<@1>/<@2>';
Typing in AddressBar (after selecting all files):
@ren _, " - "
:arrow: Will instantly rename all your files as (without preview):
Name - 01.jpg
Name - 02.jpg
...
Name - 66.jpg

Re: Alias Arguments

Posted: 05 May 2013 17:46
by CookieMonster
Setting the Example 1 Alias Definition prompts a dialog box

Code: Select all

=::msg Hello Mr<@1>
Changing <@1> prompts;
=::msg Hello Mr <@1 CookieMan>
The above two Aliases don't appear right in how it should work and do I have to keep <@1> or <@2> when creating aliases ?

Re: Alias Arguments

Posted: 06 May 2013 13:42
by TheQwerty
In the address bar type "@" and then paste those examples.
Or open Tools > List Management > Aliases
Click New and paste each one in a new entry.


One of my favorite ways to use them is to shorten addresses.

I have a bunch of projects under C:\Zen\GitHub, so I define an alias:

Code: Select all

@gh=C:\Zen\GitHub\<@0>
Now if I wanted to jump to C:\Zen\GitHub\Project-1\src I could just enter this in the address bar:

Code: Select all

@gh Project-1\src

Re: Alias Arguments

Posted: 06 May 2013 17:45
by CookieMonster
Last night, I did manage to get the basics of Aliases working that are demonstrated in the documentation :)

What arguments can I use for Aliases ? Does <@1>, <@2> etc close the argument, is that their purpose ?