Feature for "Executing DOS commands"

Features wanted...
Post Reply
JDługosz
Posts: 121
Joined: 17 Dec 2007 23:22
Contact:

Feature for "Executing DOS commands"

Post 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".

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Feature for "Executing DOS commands"

Post 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...

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Feature for "Executing DOS commands"

Post 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?

.

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Feature for "Executing DOS commands"

Post by admin »

Can anybody enlighten me about %$ ? What's the exact meaning of this and in which contexts is it used?

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Feature for "Executing DOS commands"

Post 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!

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Feature for "Executing DOS commands"

Post 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>";

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Feature for "Executing DOS commands"

Post 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.

Stefan
Posts: 1360
Joined: 18 Nov 2008 21:47
Location: Europe

Re: Feature for "Executing DOS commands"

Post 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.

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Feature for "Executing DOS commands"

Post by admin »

Actually I just changed it to simply <items> because it is used as such already in UDC OpenWith.

JDługosz
Posts: 121
Joined: 17 Dec 2007 23:22
Contact:

Re: Feature for "Executing DOS commands"

Post 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.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

Re: Feature for "Executing DOS commands"

Post 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

admin
Site Admin
Posts: 66362
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Feature for "Executing DOS commands"

Post by admin »

Arggh. Fix comes.

Post Reply