Author Topic: Go to first file  (Read 10269 times)

Novice777

  • Newbie
  • *
  • Posts: 1
    • View Profile
Go to first file
« on: October 11, 2023, 05:03:24 »
I decided to switch from Total Commander, but I couldn't create a custom command to get the focus on the first file below all the folders in the pane. This command is critical since I often have many folders, and I need to go to the first file below all the folders quickly.

Is there any way or shortcut to go to the first file on my pane?

Jungle

  • Contributor
  • VIP Member
  • *****
  • Posts: 542
  • Old Skull
    • View Profile
Re: Go to first file
« Reply #1 on: October 11, 2023, 20:27:15 »
You may create user defined command of type "Multi-Script" and bind it a to a shortcut or/and put it to the quicklaunch bar or button bar.

Code: [Select]
@var $src_path = GetSourcePath();
@var $names = GetSourceItems();

@var $count = arrayCount( $names );
@var $i;

for( $i = 0; $i < $count; $i++ )
{
  @var $file = $src_path ^ $names[ $i ];
  @var $result = FileExists( $file );
 
  if ( 1 == $result )
  {
    MC.Explorer.SetItemFocus ITEM="{$names[ $i ]}"
    break;
  }
}

I'm not sure about performance in case of too many files/folders. Also I haven't tested it with different sorting styles.