go to file with different extension

English support forum

Moderators: petermad, Stefan2, white, Hacker

oko
Senior Member
Senior Member
Posts: 291
Joined: 2007-05-03, 16:22 UTC

go to file with different extension

Post by *oko »

Is there possibility to go to file with different extension in file list? In some cases navigating through different file types would be much quicker like moving down by arrow key or page key. Especially when sorted by extension it is required enough to skip to next file type (extension).
Fla$her
Power Member
Power Member
Posts: 3435
Joined: 2020-01-18, 04:03 UTC

Re: go to file with different extension

Post by *Fla$her »

Using Autorun beta:
  1. autorun.cfg

    Code: Select all

    LoadLibrary Plugins\Autorun_Runtime.dll
    #——————————————————————————————————————
    
    # Go to the next/previous item with a different extension [1 — include folders]
    RegisterCommand 76553 GoToNextExt
    RegisterCommand 76554 GoToNextExt 1
    RegisterCommand 76555 GoToPrevExt
    RegisterCommand 76556 GoToPrevExt 1
    
    Func GoToNextExt(lParam, Dirs=0)
       Local LoopStart = RequestInfo(11007) + 1, LoopEnd = RequestInfo(11001) - 1
       If LoopStart > LoopEnd Then Return
       If Not Dirs And LoopStart < RequestInfo(11011) Then
          SendCommand(2050)
          Return
       EndIf
       Local sPanel = RequestInfo(3), Ext = FileGetExt(GetCurrentItem())
       For i = LoopStart To LoopEnd
          If Ext <> FileGetExt(StrPart(SendMessage(sPanel, 0x0189, i, 0, 2), auTAB, 1)) Then
             SendMessage(sPanel, 0x19E, i, 1)
             CommandExec('cm_Reverse', -1)
             CommandExec('cm_Reverse', -1)
             Break
          EndIf
       Next
    EndFunc
    
    Func GoToPrevExt(lParam, Dirs=0)
       Local LoopStart = RequestInfo(11007) - 1, LoopEnd = RequestInfo(11009) ? 1 : 0
       If LoopStart < LoopEnd Then Return
       Local File1Index = RequestInfo(11011)
       If Not Dirs And LoopStart < File1Index Then Return
       Local sPanel = RequestInfo(3), Ext = FileGetExt(GetCurrentItem())
       For i = LoopStart To LoopEnd Step -1
          If Not Dirs And i < File1Index Then Break
          If Ext <> FileGetExt(StrPart(SendMessage(sPanel, 0x0189, i, 0, 2), auTAB, 1)) Then
             SendMessage(sPanel, 0x19E, i, 1)
             CommandExec('cm_Reverse', -1)
             CommandExec('cm_Reverse', -1)
             Break
          EndIf
       Next
    EndFunc
  2. Totalcmd.inc:

    Code: Select all

    [________Custom Commands_________]=0
    cm_GoToNextExt=76553;
    cm_GoToNextExtD=76554;
    cm_GoToPrevExt=76555;
    cm_GoToPrevExtD=76556;
  3. Restart TC.
  4. Use cm_GoToNextExt/cm_GoToPrevExt (files) or cm_GoToNextExtD/cm_GoToPrevExtD (folders + files).
Overquoting is evil! 👎
User avatar
Stefan2
Power Member
Power Member
Posts: 4346
Joined: 2007-09-13, 22:20 UTC
Location: Deutschland

Re: go to file with different extension

Post by *Stefan2 »

Sorry, I misinterpreted the request, my solution is for "go to file with same name but different extension"
a Test.cmd
a Test.txt
a Test.zip


oko wrote: 2026-02-10, 20:33 UTC Is there possibility to go to file with different extension in file list?
Here is a trick from petermads' Extended Menus (https://ghisler.ch/board/viewtopic.php?t=33740)
"     SHOW ONLY files with same name: CD "%O.*"     "


Depending on what you do, maybe this helps too?
- select the file
- press the below button, to see all files with same name
- select the file you wanted
- press Ctrl-F10 (or CD * in tcs' command line) to see all files again, wanted file is still selected


Copy and paste button-code:

Code: Select all

TOTALCMD#BAR#DATA
cd
"%O.*"
TOTALCMD.EXE,4
Show only files with same name as the selected one(cd "%O.*")

0
-1




 
Fla$her
Power Member
Power Member
Posts: 3435
Joined: 2020-01-18, 04:03 UTC

Re: go to file with different extension

Post by *Fla$her »

2Stefan2
It's not about showing only files with the same base name, but navigating to the next extension. —>
oko wrote: 2026-02-10, 20:33 UTC skip to next file type (extension).
For this, I've been using Ctrl+Shift+Down/Up myself for a long time (at first it was .vbs)
oko wrote: 2026-02-10, 20:33 UTC when sorted by extension
Last edited by Fla$her on 2026-02-11, 08:31 UTC, edited 1 time in total.
Overquoting is evil! 👎
User avatar
Stefan2
Power Member
Power Member
Posts: 4346
Joined: 2007-09-13, 22:20 UTC
Location: Deutschland

Re: go to file with different extension

Post by *Stefan2 »

Stefan2 wrote: 2026-02-11, 07:28 UTC ...
Depending on what you do, maybe this helps too?
... 
My posts are not for the original poster only, but for all casual readers.




 
Fla$her
Power Member
Power Member
Posts: 3435
Joined: 2020-01-18, 04:03 UTC

Re: go to file with different extension

Post by *Fla$her »

Stefan2 wrote: 2026-02-11, 08:20 UTC My posts are not for the original poster only, but for all casual readers.
Hmm. This seems like an excuse for off-topic. I don't even see an auxiliary mechanism in such a recommendation.
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 16683
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: go to file with different extension

Post by *petermad »

No need for 3'rd party programs
You can put these three em_commands in your usercmd.ini file (located in the same dir as the current ini file):

Code: Select all

[em_hide_ext]
cmd=cd
param=%Z*|"*.%E"

[em_goto_next_ext]
cmd=em_hide_ext,cm_srcAllfiles

[em_goto_previous_ext]
cmd=em_hide_ext,cm_GoToPrev,cm_srcAllfiles
Then you can use em_goto_next_ext or em_goto_previous_ext for keyboard shotcuts, or in buttons to go to the next or previous extension
License #524 1994
Danish TC Translator
TC 11.57b1 32+64bit on Windows XP 32bit & Windows 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1405a
TC 3.62 on Android 6, 13, 15 & 16
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 3435
Joined: 2020-01-18, 04:03 UTC

Re: go to file with different extension

Post by *Fla$her »

petermad wrote: 2026-02-11, 09:38 UTC No need for 3'rd party programs
But a plugin is not a third-party program. I'm just suggesting you look at the difference in the resulting quality. Otherwise, I wouldn't recommend it.

Not to mention that changing the current filtration can often be an undesirable and unexpected action.
My code will work even in quick filtering conditions.
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 16683
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: go to file with different extension

Post by *petermad »

But a plugin is not a third-party program
It is still 3rd party that needs to be downloaded, installed and configured, and you'll need to edit totalcmd.inc after each update of TC.

Not to mention that changing the current filtration can often be an undesirable and unexpected action.
My code will work even in quick filtering conditions.
Excellent, if you need that.

I am not belittling your solution, I am just giving and alternative generic solution, that might solve the oko's request in an easier way.
License #524 1994
Danish TC Translator
TC 11.57b1 32+64bit on Windows XP 32bit & Windows 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1405a
TC 3.62 on Android 6, 13, 15 & 16
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 3435
Joined: 2020-01-18, 04:03 UTC

Re: go to file with different extension

Post by *Fla$her »

It is still 3rd party that needs to be downloaded, installed and configured, and you'll need to edit totalcmd.inc after each update of TC.
Downloading is not an argument. Would you call Imagine or Irfanview plugins third-party? After all, separate packages are also provided for them.
And without settings, nothing will work in your case either. You don't have to edit totalcmd.inc after each update, only when new commands appear.
By the way, it only needs to be edited for clarity and for using the button [🔎…] (cm_CommandBrowser) on the Misc. page. For buttons, menus, and hotkey ini keys, you can use command numbers.
Excellent, if you need that.
Don't you need to? 🙄
I am not belittling your solution, I am just giving and alternative generic solution
I understand, but I suggest once again that you compare it experimentally to feel the value of a good choice.
Last edited by Fla$her on 2026-02-11, 12:38 UTC, edited 1 time in total.
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 16683
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: go to file with different extension

Post by *petermad »

Don't you need to?
No, I don't need the function at all, in neither yours nor my implementation.

I hadn't thought of the need for this until I saw this topic.

You don't have to edit totalcmd.inc
But the user has to check for new commands at new TC-updates
License #524 1994
Danish TC Translator
TC 11.57b1 32+64bit on Windows XP 32bit & Windows 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1405a
TC 3.62 on Android 6, 13, 15 & 16
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Fla$her
Power Member
Power Member
Posts: 3435
Joined: 2020-01-18, 04:03 UTC

Re: go to file with different extension

Post by *Fla$her »

I hadn't thought of the need for this until I saw this topic.
Then it's clear. I thought you used this yourself, because the request itself (from other users) is very old for me. I use it relatively rarely myself.
But the user has to check for new commands at new TC-updates
For portable needs, we have to check a lot (localization files like menus, help files, etc.). We must not allow the replacement of icon libraries or something else. This is a natural process for a non-standard update, if it's not automated, of course.
But as I wrote above, this is just an optional setting for activation. This will work too:

Code: Select all

[Shortcuts]
CS+DOWN=76553
CS+UP=76555
Overquoting is evil! 👎
oko
Senior Member
Senior Member
Posts: 291
Joined: 2007-05-03, 16:22 UTC

Re: go to file with different extension

Post by *oko »

thanks to all for answers.

To petermad: as I prefer non-3rd-party your solution would be sufficient for me, but it doesnt work always because after the filter is applied the cursor do not skip to immediately next visible file but second or so depending on how much files are hidden by filter. So after canceling filter the cursor may be on next or other next file type. Previous has the same unreliable results.

To flasher: The vbs would be better for me if it could work without installing plugin and inc changing.
Fla$her
Power Member
Power Member
Posts: 3435
Joined: 2020-01-18, 04:03 UTC

Re: go to file with different extension

Post by *Fla$her »

without installing plugin
Do you have any problems with this? If you want quality (not only for this task, but also for many others), then you will have to install it.
There is nothing similar that will work better and faster, since the code and functions are already loaded into memory at the time of execution. This is better than using third-party processes.

But you can use the simple command chain. —>

527,525,3305,2053,524 — navigate to the file with the next extension
527,525,3305,2054,524 — navigate to the file with the previous extension

This is exactly the algorithm used on vbs when there were no command chains in TC yet.
It's not as clean and elegant, but it might suit you.
Overquoting is evil! 👎
oko
Senior Member
Senior Member
Posts: 291
Joined: 2007-05-03, 16:22 UTC

Re: go to file with different extension

Post by *oko »

2Fla$her
Thank you. Your chain suits me, it is sufficient quality for me. It seems it works well. It cancels eventual selection but I dont mind (as far, practice will show).
Post Reply