Multi Commander > Script

Get the source/target path based on the active panel

(1/1)

feranti:
Hello,

NB: I know there is a difference between selected and focused but I couldn't find a clear description. In the following, I will assume that focused is when the element is surrounded by two horizontal lines and selected is when it is highlighted. Can you confirm, please?

I would want to execute a command (let's say a SVN update) to the selected element OR, if no element is selected (I don't care if it is focused), to the parent folder (the folder whose path is showed in the bar of the panel). And I would want that it works no matter which panel I'm on.

No tag seems to fulfill these specifications. I assume I will have to write a MC script to figure out the active panel (how ?), then check if any file/folder is selected (how ?), and launch the command to the right file/folder accordingly.

1. Did I miss something here? a tag or something?
2. How can figure out the active panel?
3. How can I check if any file/folder is selected?

Thank you

feranti:
Ok, after some better researchs, I got some clues:
Concerning the point 2, sourcepath is always the active panel path and target is the inactive panel.
Concerning the point 3, it seems that there are no way to have no files focused in MC. GetSourceSelectedFileNames() always returns selected files or focused files if no selection. Am I wrong there?

Mathias (Author):
Focus is the item that the "cursor" is on. normally the item in focus is also selected but you can have multiple items as selected.
By default a small "frame" is drawn around the focus item.. (If you press up or down arrow key it is from this item it will go from)


1. Depending on script. but you can get focus item and source (active) path with MultiTags..
2. ${sourcepath} or GetSourcePath(..) ( http://multicommander.com/docs/multiscript/functions/getfilefromview#getsourcepath )
The active panel is the Source panel. Target panel is the active tab on the other panel side

3. GetSelectedXXXXX (many different function depending on if you want full path or just filename and so on, both for source and target location )
Yes focus item get included if no items are selected.

feranti:
Thank you Mathias,
I ended up writing two user commands: one for selected/focused file(s) and one for the parent directory.

Reset:
A question later: If no file was selected, then counts, over which the mouse pointer is?

Thanks for the answer

Navigation

[0] Message Index

Go to full version