user commands: examples and help

A collection of especially useful xplorer² topics and ideas. New users may find it helpful to look here before searching the other forums for information. >>>>>> Please post new material in the relevant forum. (New stuff posted here will be removed.) Thanks. -fg-

Moderators: fgagnon, nikos

Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

nikos wrote:$N doesn't automatically insert quotes around the name since you may want to use it in combination with something else.
I might suggest narayan adds a small note of this distinction to the manual... as, oddly, it only contains one reference to $S, and only one reference to "$N" for inclusive spaces.  Just a thought.
User avatar
nikos
Site Admin
Site Admin
Posts: 15759
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Post by nikos »

all you need to know is here, especially the small print near the bottom

Image
Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

<Sigh> I was referring to "$N doesn't automatically insert quotes around the name" but $S does {so is implied}.

Show me the fine-print on that one, daddy-O.  :wink:
User avatar
nikos
Site Admin
Site Admin
Posts: 15759
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Post by nikos »

let's hang the guy who wrote the manual :)
automatic quotes on spaces are provided only for $A and $S, all the rest either use lowercase versions or supply quotes yourself eg "$N"
Mr.Pleasant
Silver Member
Silver Member
Posts: 281
Joined: 2006 Dec 29, 12:56
Location: Utrecht, NL

Post by Mr.Pleasant »

[quote][/quote]
Am I still in time to refrase the User command for Renamer:

Code: Select all

> "C:\Program Files\ReNamer\renamer.exe" /enqueue $S
Much better in case you have to rename a lot of files. Just did a test with renaming 1000 files. My old command makes your computer hang in pure panic, whereas the new command works without problems.
profess
Silver Member
Silver Member
Posts: 307
Joined: 2003 Oct 06, 11:39

Post by profess »

hi guys,

thanks very much for the examples so far.  they have been really helpful in getting my head around user commands.  some are a little advanced for me and it's all been useful.  

posts like these help everyone to learn, and those versed in the arts of user commands even learn a little too, even if it's only to explain the commands to others (like moi! :)  one of the true signs of ability / cleverness (if you like) is if one can 'break down' the most complex subject into a language others can understand.

some of the previous posts we've had (i.e. solve this problem - search the forum for 'quiz' (no quotes)) have been good, even if just to stand back and admire.

i've learned to use $$ (didn't know it existed), windirstat (another freeware app - yes!) and that a program could be specified to open the selected file (i.e. notepad++).

so i've dabbled a bit more into the commands.  i've set up a couple more buttons for easy access.  i know how to create simple commands (thanks Mr. Pleasant) - like > calc, and will go about the more complex ones as i learn more.

i'm stuck with something, which others may find simple...

i wish to move the selected files to the parent folder.  simple, right?  every now and then i run into a scenario whereby i wish to move the selected files to the parent folder.

so far i have a user command which looks like:

Code: Select all

$$ move "$N" ..
it works, hurrah (and didn't before these posts), but i'm left with a console / dos window.  any help with this?  is there a command i could use to close it or not bring it up in the first place?  

OR

can i use a batch or cmd file (if different) to do this command.  

Code: Select all

move "$N" ..
exit
the above command does not work though and dos seems not to understand the $ symbol when used in this way.

again i'm helpful for any comments or help...
---

nikos - could there be an 'add' command in the user command's 'organize' dialog?  this would be handy as i'm having to switch back and forth.

also nikos - flocks like to be pleased, and a happy flock is a happy shepherd. the shepherd may use the wool for warmth, and sell the wool to buy beers! :)
User avatar
nikos
Site Admin
Site Admin
Posts: 15759
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Post by nikos »

there's no easy way to get rid of the console automatically -- but it is only one, you won't get more. THe easiest way out would be to use a command that doesn't require the dos interpreter, e.g. instead of move use xcopy. First try $ xcopy /? to see its syntax then use it as >> xcopy ...
User avatar
nikos
Site Admin
Site Admin
Posts: 15759
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Post by nikos »

I thought you could execute multiple user commands if you separate them with commas as usual, but that doesn't seem to work
actually multiple (user) commands can be executed using commas as usual already, you just have to specify the batch mode e.g.

Code: Select all

$ echo 1, echo $n
plain command mode, just one echo executed typing "1, echo $n"

Code: Select all

$$ echo 1, echo $n
in multi-mode $$ two echos result for each selected item

Code: Select all

$$ echo 1,, echo $n
if you want to use the comma verbatim in multi mode put two commas in a row. The above example will result in a printout "1, echo $n" for each file selected
Mr.Pleasant
Silver Member
Silver Member
Posts: 281
Joined: 2006 Dec 29, 12:56
Location: Utrecht, NL

Post by Mr.Pleasant »

That's cool, I didn't know that!
(Er... is this a case of RTFM, or Update it? :lol: )
profess
Silver Member
Silver Member
Posts: 307
Joined: 2003 Oct 06, 11:39

Post by profess »

The manual is excellent, just a little weaker in some areas. Maybe people could contribute to 'advanced' areas, if it's deemed so with examples or so.

But on the flip side, everyone learns by coming to the forum..
Kilmatead
Platinum Member
Platinum Member
Posts: 4569
Joined: 2008 Sep 30, 06:52
Location: Dublin

Post by Kilmatead »

Ran into another bit of an anomaly... as before, with the "$N" (or "$F") vs. $S tokens... the theory goes that both of these commands should do the same thing:

> "C:\Program Files\zabkat\xplorer2\editor2_64.exe" "$N"

> "C:\Program Files\zabkat\xplorer2\editor2_64.exe" $S

...except for some reason $N (or $F) retains the last selected file as an argument and passes it to ed2, even if that file is explicitly deselected before calling the user command.

This does not happen with $S, which behaves as expected - the deselected file is not passed, and ed2 opens empty, as it should.

Selecting/deselecting is done via the middle-mouse-button, under Vista.

This happens with notepad++ as well, so it isn't the application.

Is this supposed to happen, or am I missing something?  Nikos?

(And damn you Mr.unPleasant :wink: for making me experiment with $F and $N... I always used $S before you gave your examples and everything worked fine.  Definitely a matter of "if it ain't broke..." :D)

=============
from admin:
Nikos'response to the above observation and further discussion on focus etc. have been split to the following thread:
viewtopic.php?t=7300
-fg-
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Post by FrizzleFry »

I think it would be nice if all the file/folder tokens would automatically add quotes only if needed. Except for $A and $S I always quote the file/folder tokens I use in my user commands but I have found a place where this is a problem.... when $P or $I refer to a drive root folder you end up with "C:\" for example. This sometimes generates an error because the program executed by the user command receives C:" rather than C:\

(removed erroneous comment)
Last edited by FrizzleFry on 2009 Oct 13, 15:34, edited 1 time in total.
User avatar
nikos
Site Admin
Site Admin
Posts: 15759
Joined: 2002 Feb 07, 15:57
Location: UK
Contact:

Post by nikos »

i've just tested it and both $i and $p are correct 8.3 names without spaces
User avatar
FrizzleFry
Platinum Member
Platinum Member
Posts: 1241
Joined: 2005 Oct 16, 19:09

Post by FrizzleFry »

Yeah, not sure what I did yesterday but today the $i token does give me the short folder names... those are ugly though...

I found a workaround for the "C:\" problem with CloneSpy... add a space after the token... "$I " or "$P "... it works.

CommandLineToArgvW has a special interpretation of backslash characters when they are followed by a quotation mark character ("), as follows:

   * 2n backslashes followed by a quotation mark produce n backslashes followed by a quotation mark.
   * (2n) + 1 backslashes followed by a quotation mark again produce n backslashes followed by a quotation mark.
   * n backslashes not followed by a quotation mark simply produce n backslashes.

The idiocy of Microsoft is astounding at times.
User avatar
IneedHelp
Gold Member
Gold Member
Posts: 612
Joined: 2010 Feb 04, 02:15
Location: MeanWhile City

Post by IneedHelp »

profess wrote:i wish to move the selected files to the parent folder.
PM Kilmatead in regard to this. Call me crazy if he doesn't have something for you. I know it has been two years since you posted that, but habit may still be there.
Post Reply