Need help with parameters in user command

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Jungle
Member
Member
Posts: 129
Joined: 2005-12-03, 11:18 UTC
Contact:

Need help with parameters in user command

Post by *Jungle »

I've created an alias:

Code: Select all

Command:    PowerGREP
Parameters: change_href.pga /folder "%P" /masks "%N" "" 0 /backup 4 0 /save "%P%N_results.txt" /execute /quit
Start Path: c:\Program Files\PGREP3\
Now imagine i'm in the e.g. e:\bk\1 1\ dir.
When i launch my alias on any file, PowerGREP displays ACCESS VIOLATION error and doesn't perform the action.

If i remove %N from "%P%N_results.txt" or all /save parameter, PowerGREP works as expected but only with filenames not containing spaces. And it still doesn't work with filenames containing spaces.

If i launch a command

Code: Select all

C:\Program Files\PGREP3>powergrep change_href.pga /folder "e:\bk\1 1\" /masks "New 2006.htm" "" 0 /backup 4 0 /save "e:\bk\1 1\New 2006.htm_results.txt" /execute /quit
from console it always works successfully.

What should i do for my command to work properly?
User avatar
nsp
Power Member
Power Member
Posts: 1804
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

One of the thing you can do is adding a ? as first place in the parameter section.

With this, you will see how TC send the command. Verify if nothing is strange there....

If an extra " appear somewhere, you have to reedit the button. Add and Remove spaces at end of each section save and try again.

push again...... (pray if you think it can help ;) )
Jungle
Member
Member
Posts: 129
Joined: 2005-12-03, 11:18 UTC
Contact:

Post by *Jungle »

1. Thanks

2. It seems than %N parameter inserts extra " symbols

When the filename contains spaces /masks "%N" becomes /masks ""some file name"". It can be solved by replacing "%N" with %N

But even if filename doesn't contain spaces, and the path does, %P%N_results.txt becomes "some path\name.ext"_results.txt.

So i consider it a bug. I think user itself should decide when and where to put "

P.S. TC 7 pb1
User avatar
nsp
Power Member
Power Member
Posts: 1804
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

Jungle wrote:1. Thanks

P.S. TC 7 pb1
You should test TC7pb2 that is much more stable than pb1 (at least for me).

I've done some test and it seem :roll: that the problem you describe does not appear...

Anyway, I alway use the ? during the first calls to verify/debug if the cut and paste in the cmd windows does what i want !

sometimes you also need to change codepage (chcp) to have proper char mapping :wink:
User avatar
Hacker
Moderator
Moderator
Posts: 13064
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

[mod]Moved to TC 7 beta discussion forum.

Hacker (Moderator)[/mod]
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48079
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

Unfortunately I can't do anything about it. I have to include the "" because many people simply forget them, and then parameters do not work.

I can only recommend that you use a batch or interim EXE which assembles the parameters correctly for this rather complex line of parameters.
Author of Total Commander
https://www.ghisler.com
Jungle
Member
Member
Posts: 129
Joined: 2005-12-03, 11:18 UTC
Contact:

Post by *Jungle »

ghisler(Author) wrote:Unfortunately I can't do anything about it. I have to include the "" because many people simply forget them, and then parameters do not work.
Then why you don't include "" with %P? I think you haven't to do that because using of "" with the paths containing spaces is the common rule. And people should learn to use "" properly. IMHO.

Anyway you really CAN solve this problem e.g. with ini-file parameter like AutoQuoteLongPaths=0|1
User avatar
RID500
Member
Member
Posts: 194
Joined: 2006-11-20, 12:38 UTC

Post by *RID500 »

ghisler(Author) wrote:... I have to include the "" because many people simply forget them, ....
Why are people they know what they do limited to do work arounds?
TC is an Tool for my daily work and should do what i need
and not thrust me do find other methods for standard situations.
It's time for an TotalCommander-Pro version?


AutoQuoteSpace=0 => No Quotes at all, i do this my self
AutoQuoteSpace=1 => Yes, please help me with Quotes
AutoQuoteSpace=2 => One leading Quote at the begin only, please.

Support++

rid
User avatar
nsp
Power Member
Power Member
Posts: 1804
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Post by *nsp »

ghisler(Author) wrote:Unfortunately I can't do anything about it....
..... :cry: ......

A) Some code can be done ( a rough algorithm can be)
you can interpret the command line/parameter catching each blank/tab separated token....
for each token replace the %§ with the converted values
quote the token if it is needed(1)

recompose the entire command...

B) you can have a parameter as suggested in the prior post.


(1) mainly if space are inside and the token is not quoted..
Post Reply