Page 1 of 1

Feature for "Executing DOS commands"

Posted: 17 Aug 2010 19:56
by JDługosz
Typing ! or !! in the Address Bar, I want to pull in the highlighted file name or names. I suggest %$, to be consistant with command-line syntax, and you already support % for environment variables.

E.g. !!regsvr32 %$

Writing this, it occurs to me that there must be a way to refer to current items and such in the scripting and custom command area, which I've not read up on, so maybe I missed something. But nothing of the sort is documented under "Address Bar".

Re: Feature for "Executing DOS commands"

Posted: 03 Sep 2010 10:35
by admin
The current item would be <curitem>, but this variable is currently not resolved in the context of a DOS command. I'm not sure whether it's a good idea to support such variables in this context, and have no time to think very hard about it. But I will listen to suggestions...

Re: Feature for "Executing DOS commands"

Posted: 03 Sep 2010 11:22
by Stefan
JD&#322;ugosz wrote:Typing ! or !! in the Address Bar, I want to pull in the highlighted file name or names.
I suggest %$, to be consistant with command-line syntax, and you already support % for environment variables.

E.g. !!regsvr32 %$
Sounds cool.

Right now i would use:

::run "cmd /k command";
::run "cmd /k echo Hello";
::run "cmd /k echo <curitem>";

::run "cmd /k regsvr32 <curitem>";
(don't know if the quoting is enough here)

- - -

And, BTW, it would be nice if the var <curitemS> would be available here too, to get:
"x:\path\to\name.ext" "x:\path\to\name.ext" "x:\path\to\name.ext"
Worth to open an extra wishes thread for that?

.

Re: Feature for "Executing DOS commands"

Posted: 03 Sep 2010 11:48
by admin
Can anybody enlighten me about %$ ? What's the exact meaning of this and in which contexts is it used?

Re: Feature for "Executing DOS commands"

Posted: 03 Sep 2010 11:50
by admin
Stefan wrote:And, BTW, it would be nice if the var <curitemS> would be available here too, to get:
"x:\path\to\name.ext" "x:\path\to\name.ext" "x:\path\to\name.ext"
Worth to open an extra wishes thread for that?
Good idea!

Re: Feature for "Executing DOS commands"

Posted: 03 Sep 2010 12:36
by Stefan
admin wrote:Can anybody enlighten me about %$ ? What's the exact meaning of this and in which contexts is it used?
%$ is meant as an variable parameter, here for the regsvr32 command.

Analog to an CMD batch
@ECHO OFF
regsvr32 %1


or with XYplorer
run cmd /c regsvr32 "<curitem>";

Re: Feature for "Executing DOS commands"

Posted: 03 Sep 2010 13:56
by admin
Stefan wrote:
admin wrote:Can anybody enlighten me about %$ ? What's the exact meaning of this and in which contexts is it used?
%$ is meant as an variable parameter, here for the regsvr32 command.

Analog to an CMD batch
@ECHO OFF
regsvr32 %1


or with XYplorer
run cmd /c regsvr32 "<curitem>";
Ok, but I think this will be fine as well:

Code: Select all

!!regsvr32 "<curitem>"
!!regsvr32 <selitems>*
* I perfer <selitems> to <curitems> as var name for your proposal.

Re: Feature for "Executing DOS commands"

Posted: 03 Sep 2010 15:00
by Stefan
admin wrote:Ok, but I think this will be fine as well:

Code: Select all

!!regsvr32 "<curitem>"
!!regsvr32 <selitems>*
admin> "this will be fine"
So it's not implemented yet? Good!
Otherwise It seams i have problems with the syntax :mrgreen: :

I don't enjoy to register an dll right now, so
My <curitem> is this batch:
@ECHO OFF
ECHO %1
PAUSE


This works:
::run "<curitem> Hello";

This not:
! "<curitem> Hello";

admin wrote: * I prefer <selitems> to <curitems> as var name for your proposal.
<selitems> sounds fine.
<curitemS> was only suggested because i thought there is already <curitemS>, but this is <item> and <items> what i had in mind.

Re: Feature for "Executing DOS commands"

Posted: 03 Sep 2010 15:07
by admin
Actually I just changed it to simply <items> because it is used as such already in UDC OpenWith.

Re: Feature for "Executing DOS commands"

Posted: 03 Sep 2010 20:05
by JDługosz
"<curitem>" is a bit much to type, compared to %1 or %$. A command involving "this thing" is the most common reason for using the bar for the purpose, I would think.

Re: Feature for "Executing DOS commands"

Posted: 07 Sep 2010 16:45
by TheQwerty
admin wrote:Actually I just changed it to simply <items> because it is used as such already in UDC OpenWith.
And thus broke the previously expected (and documented) behavior of OpenWith... as now XY's scripting engine will parse the Application argument and resolve "<items>" and then the OpenWith command will parse the arguments and not finding '<items>' append them to the end of the command.

Therefore, making it a real pain in the butt to position '<items>' among other arguments that are being passed to the application, and of course breaking existing scripts that relied on this behavior.


EDIT: Further experimentation shows that just OpenWith (even as a UDC) is broken as it has forgotten all about '<items>' and will happily expand '<items>' and then append the items again.

EDIT 2: The Return of Edit:
An example:
Using

Code: Select all

"D:\Downloads\Apps\AutoHotkey\My Scripts\Samples\ARGS.exe" -- <items> -STOP
for my application, which just prints out the passed arguments.
v9.40.0104 wrote:1=--
2=D:\Downloads\Apps\Installers\X\XYplorer\9.40.0104.zip
3=D:\Downloads\Apps\Installers\X\XYplorer\9.40.0107.zip
4=D:\Downloads\Apps\Installers\X\XYplorer\9.50.0000.zip
5=-STOP
v9.50 wrote:1=--
2=D:\Downloads\Apps\Installers\X\Xyplorer\9.40.0104.zip
3=D:\Downloads\Apps\Installers\X\Xyplorer\9.40.0107.zip
4=D:\Downloads\Apps\Installers\X\Xyplorer\9.50.0000.zip
5=-STOP
6=D:\Downloads\Apps\Installers\X\Xyplorer\9.40.0104.zip
7=D:\Downloads\Apps\Installers\X\Xyplorer\9.40.0107.zip
8=D:\Downloads\Apps\Installers\X\Xyplorer\9.50.0000.zip

Re: Feature for "Executing DOS commands"

Posted: 07 Sep 2010 18:08
by admin
Arggh. Fix comes.