Page 1 of 1
Need help with parameters in user command
Posted: 2006-12-12, 09:22 UTC
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?
Posted: 2006-12-12, 09:52 UTC
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

)
Posted: 2006-12-12, 10:30 UTC
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
Posted: 2006-12-12, 16:16 UTC
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

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

Posted: 2006-12-12, 20:06 UTC
by Hacker
[mod]Moved to TC 7 beta discussion forum.
Hacker (Moderator)[/mod]
Posted: 2006-12-12, 21:17 UTC
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.
Posted: 2006-12-13, 06:22 UTC
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
Posted: 2006-12-13, 07:13 UTC
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
Posted: 2006-12-13, 07:35 UTC
by nsp
ghisler(Author) wrote:Unfortunately I can't do anything about it....
.....

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