Multi Commander Support Forum

Multi Commander => Script => Topic started by: arewar on July 02, 2015, 18:14:31

Title: FocusPath/TargetPath/SourcePath empty?
Post by: arewar on July 02, 2015, 18:14:31
I'm trying to make a button that runs a program with certain directory information. I'm creating a user command batch script.

This is what I have in my script area. It changes to the directory I need, runs the program and feeds in the "focusfilepath". What I show below works great, but what I need is ${focuspath} instead of focusFILEpath. When I use ${focuspath} it does not give me any data, it's just empty.

I've also tried targetpath and sourcepath, which are also empty. But their FILE-counterparts work too. Am I missing something to get just the directory?

D:
cd D:\Test\_QA\check
CreateChecksum -NODB "${focusfilepath}" 5000000 0
Title: Re: FocusPath/TargetPath/SourcePath empty?
Post by: Mathias (Author) on July 02, 2015, 18:54:51
http://multicommander.com/docs/multitags

use ${sourcepath} to get the path of the active panel. 
Title: Re: FocusPath/TargetPath/SourcePath empty?
Post by: arewar on July 02, 2015, 22:41:41
As I said... I tried sourcepath, targetpath, and focus path.

I've tried again to verify and have the same results. ${sourcepath} gives no information. ${sourcefocuspath} however, does return a selected file.


Edit - is it possible to store these in variables in Batch files?

Success:
echo ${sourcepath}

Failure:
set test = ${sourcepath}
echo %test%
Title: Re: FocusPath/TargetPath/SourcePath empty?
Post by: Mathias (Author) on July 03, 2015, 05:30:43
As I said... I tried sourcepath, targetpath, and focus path.

I've tried again to verify and have the same results. ${sourcepath} gives no information. ${sourcefocuspath} however, does return a selected file.


Edit - is it possible to store these in variables in Batch files?

Success:
echo ${sourcepath}

Failure:
set test = ${sourcepath}
echo %test%

It works.. But you need to write it correct..  bat files do not like spaces.
set test=${sourcepath}

Title: Re: FocusPath/TargetPath/SourcePath empty?
Post by: arewar on July 06, 2015, 16:48:27
Thank you. Apologies for my stupidity!

I figured out the reason for my problem was the sourcepath was giving me a trailing slash, which caused my program to fail and therefore appear to be empty. Your comment helped me get it in a variable, so then I could edit the string to be what I needed.

set test=${sourcepath}
set newtest=%test:~0,-2%"
echo %newtest%
D:
cd D:\Test\_QA\check
CreateChecksum -NODB %newtest% 5000000 0
pause

Thanks for your assistance.