Author Topic: User Defined Command to go into sub-directory. **Resolved**  (Read 3627 times)

jdabramson

  • Newbie
  • *
  • Posts: 4
    • View Profile
After reading up a bit, this may be solvable by issuing a User Defined Command rather than QuickLinks previously questioned.

What User Defined Command can be created do the following?

  • get the current path of the selected pane
  • append a predefined path to the existing path
  • open the new path to the selected pane

My company has a project folder structure that is the same for every project.  In this case, I have the following projects as an example.
   
Here are three projects:

"F:\31\31935\3193518"
"F:\31\31936\3193602"
"F:\31\31940\3194011"

Every Project has the same folder structure and here are the typical folders I access.

\01_PM\BILLING\
\01_PM\CONTACT\
\02_COMM\MINUTES\
\03_PROJECT_EXECUTION\02_PHOTOS\
\03_PROJECT_EXECUTION\05_PRJ_FUNDING\
\03_PROJECT_EXECUTION\06_PERMITS\
\05_DELIVERABLES\

Therefore the following are my I would set to the following User Defined Commands as shortcuts to go to the subdirectories and execute each as appropriate after navigating to the project directory.

i.e.
existing_path = F:\31\31940\3194011

BILLING         existing_path\01_PM\BILLING\
CONTACT         existing_path\01_PM\CONTACT\
MINUTES         existing_path\02_COMM\MINUTES\
PHOTOS         existing_path\03_PROJECT_EXECUTION\02_PHOTOS\
PRJ_FUNDING      existing_path\03_PROJECT_EXECUTION\05_PRJ_FUNDING\
PERMITS         existing_path\03_PROJECT_EXECUTION\06_PERMITS\
DELIVERABLES    existing_path\05_DELIVERABLES\
« Last Edit: August 22, 2023, 22:48:14 by jdabramson »

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4286
    • View Profile
    • Multi Commander
Re: User Defined Command to go into sub-directory.
« Reply #1 on: August 22, 2023, 19:58:45 »
There are two way depending on how good error handling you want..

1.
You can in the command line field type "cd temp\myfolder" and it will take you to "<currentpath>\temp\myfolder"

But instead of typing that in the commandline field you can automate that with a "Custom Commands" type Command..
Code: [Select]
MC.CmdLineRun CMD="cd Temp\myfolder"

However if path "mtemp\yfolder" does not exists, but temp\ exists, it will go into temp\ anyway.. there is no check if path exists.

2. User defined command of "MultiScript" type

Code: [Select]
@var $currentPath = GetSourcePath();
@var $newPath = $currentPath ^ "Temp\\MyFolder1"

if( FileExists($newPath) == 2 )
{
 MC.Explorer.Goto PATH="{$newPath}" SOURCE
}
It will only go to the path if the path exists, else it does nothing.


jdabramson

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: User Defined Command to go into sub-directory.
« Reply #2 on: August 22, 2023, 22:47:39 »
Worked perfectly... Thank you for taking your time to post the reply.