Author Topic: Get the source/target path based on the active panel  (Read 23407 times)

feranti

  • Newbie
  • *
  • Posts: 3
    • View Profile
Get the source/target path based on the active panel
« on: October 19, 2017, 12:25:30 »
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
« Last Edit: October 19, 2017, 12:27:32 by feranti »

feranti

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Get the source/target path based on the active panel
« Reply #1 on: October 19, 2017, 13:37:20 »
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)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4271
    • View Profile
    • Multi Commander
Re: Get the source/target path based on the active panel
« Reply #2 on: October 19, 2017, 19:35:54 »
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

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Get the source/target path based on the active panel
« Reply #3 on: November 06, 2017, 11:39:58 »
Thank you Mathias,
I ended up writing two user commands: one for selected/focused file(s) and one for the parent directory.

Reset

  • Junior Member
  • **
  • Posts: 10
    • View Profile
Re: Get the source/target path based on the active panel
« Reply #4 on: November 06, 2017, 14:02:53 »
A question later: If no file was selected, then counts, over which the mouse pointer is?

Thanks for the answer