Looking for help with the correct syntax for a command. Trying to pass the pathname for left and right pane to an external program. I've put msg statements into the script for debugging, and they appear to return the correct (expected) values. Also hard-wired some example pathnames into the script, and that works properly. The last line of my script fails -- it launches the program (a file-sync program that needs two pathnames as arguments), but the incorrect file folders are selected.
$path = tab("get", "path");
$pathi = get("path", i);
msg $path;
msg $pathi;
msg run '"C:\Program Files\FreeFileSync\FreeFileSync.exe" -leftdir $path -rightdir $pathi';
run '"C:\Program Files\FreeFileSync\FreeFileSync.exe" -leftdir "C:\Program Files\Collage Maker" -rightdir "E:\AUDIBLE\Podcasts\"';
run '"C:\Program Files\FreeFileSync\FreeFileSync.exe" -leftdir "$path" -rightdir "$pathi"'
As mentioned, the third msg line displays correct values, the first "run" command (hardwired pathnames) works properly, but the second one fails. Same results WITH or WITHOUT the quotations around the $path and $pathi variables.
Thanks in advance.
Script help - path names as arguements
-
- Posts: 855
- Joined: 05 Oct 2011 13:15
Re: Script help - path names as arguements
Hi'
This line should suffice:- - - - - - - - -
As for the reason of your problem, I think it comes from using command-line arguments outside quotes. So if you're sure about your command-line, it should work if rewritten as:or
Hope this helps,
Flux
This line should suffice:
Code: Select all
run "C:\Program Files\FreeFileSync\FreeFileSync.exe" "<get path a>" "<get path i>";
As for the reason of your problem, I think it comes from using command-line arguments outside quotes. So if you're sure about your command-line, it should work if rewritten as:
Code: Select all
run """C:\Program Files\FreeFileSync\FreeFileSync.exe"" -leftdir ""$path"" -rightdir ""$pathi""";
Code: Select all
run "C:\Program Files\FreeFileSync\FreeFileSync.exe" "-leftdir" "$path" "-rightdir" "$pathi";
Flux
• Scripts: Session Manager | SlideShow | Collection Manager | Power Launcher | Akelpad syntax highlighting | ...
-
- Posts: 32
- Joined: 07 Dec 2011 05:33
Re: Script help - path names as arguements
Excellent!
The single-line function did not work. There was an error dialog from the external program that the folder could not be found. However, your first version replacement for my line worked perfectly. Did not try the second one...
Dunno if it's just me, but I found the syntax regarding quotation marks to be extremely frustrating. Probably spent two hours in three different sessions, trying every combination I could think of. Obviously missed a few!!
Thanks again for your input and solution.
The single-line function did not work. There was an error dialog from the external program that the folder could not be found. However, your first version replacement for my line worked perfectly. Did not try the second one...
Dunno if it's just me, but I found the syntax regarding quotation marks to be extremely frustrating. Probably spent two hours in three different sessions, trying every combination I could think of. Obviously missed a few!!
Thanks again for your input and solution.
-
- Posts: 855
- Joined: 05 Oct 2011 13:15
Re: Script help - path names as arguements
Oh... It's been a while since I used FreeFileSync, they must have changed their command-line options.jacksonmacd wrote:The single-line function did not work. There was an error dialog from the external program that the folder could not be found.
- - -
• A quick explanation about the quotes here: I put the whole argument of run inside single-quotes:
run "argument";
- but as part of the argument, there are several elements (paths) that may contain spaces, so each of them need to be quoted:
"path"
- but since they're themselves inside the quotes of the run argument, they need to be double-quoted instead of single-quoted:
run " ""apppath"" command ""otherpath"" ";
• Scripts: Session Manager | SlideShow | Collection Manager | Power Launcher | Akelpad syntax highlighting | ...
Re: Script help - path names as arguements
My English is not good enough.
I use XYplorer and FreeFileSync some time.By use the customize button,I put the 2 Program together, something which may be just what you want.
Of course, my FreeFileSync folder on the inside XYplorer's. FreeFileSync is a green software, So,direct Copy it to there,or change the Sentence to fit you.
the script in Button's Editor,only written a single line.
I like this use, in good condition.
I use XYplorer and FreeFileSync some time.By use the customize button,I put the 2 Program together, something which may be just what you want.
Code: Select all
sel;$str11=quote(get("path",1));$str21=quote(get("path",2));openwith """<xypath>\FreeFileSync\Bin\FreeFileSync_Win32.exe"" -leftdir $str11 -rightdir $str21", s;
Of course, my FreeFileSync folder on the inside XYplorer's. FreeFileSync is a green software, So,direct Copy it to there,or change the Sentence to fit you.
the script in Button's Editor,only written a single line.
I like this use, in good condition.