Jump to content

Total Commander Quick Restart Script


shaamaan
 Share

Recommended Posts

i have seen several utilities to do this function, but this one in autoit is realy super short and easy to understand, so check it out!

if processexists("TOTALCMD.EXE") then
processclose("TOTALCMD.EXE")
run("Totalcmd.exe")
else
msgbox(0, "Error", "Total Commander is not run!")
endif
Link to comment
Share on other sites

You on the right way :ph34r:

I'm for a long time use Autoit for making additions for TC, that I compile into my own private distributive for using in my company.

This is my version of script:

Opt("WinTitleMatchMode", 2)
WinClose("Total Commander")
If WinExists("Total Commander") Then ProcessClose("totalcmd.exe")
Run(@ScriptDir & "\..\..\totalcmd.exe")

That other example, directs left panel into system folders, no matter where windows installed.

If $CmdLine[0] = 0 then exit
Select
    Case $CmdLine[1] == "system"
        GoToDir (@SystemDir)
    Case $CmdLine[1] == "mydoc"
        GoToDir (@MyDocumentsDir)
    Case $CmdLine[1] == "desktop"
        GoToDir (@DesktopDir)
    Case $CmdLine[1] == "startmenu"
        GoToDir (@StartMenuDir)
    Case $CmdLine[1] == "favorites"
        GoToDir (@FavoritesDir)
    Case $CmdLine[1] == "sendto"
        GoToDir (@UserProfileDir & "\SendTo")
    Case $CmdLine[1] == "programs"
        GoToDir (@ProgramsDir)
    Case $CmdLine[1] == "startup"
        GoToDir (@StartupDir)
    Case $CmdLine[1] == "tempint"
        GoToDir (@UserProfileDir & "\Local Settings\Temporary Internet Files")
    Case $CmdLine[1] == "appdata"
        GoToDir (@UserProfileDir & "\Local Settings\Application Data")
    Case Else
        Exit
EndSelect

Func GoToDir ($sDir)
    Opt("RunErrorsFatal", 0)
    $tc_path = @ScriptDir & "\..\..\totalcmd.exe "
    Run($tc_path & '/L="' & $sDir & '" /O')
EndFunc

Maybe we need to make topic with ideas and addons for TC?

Link to comment
Share on other sites

You on the right way :ph34r:

I'm for a long time use Autoit for making additions for TC, that I compile into my own private distributive for using in my company.

This is my version of script:

Opt("WinTitleMatchMode", 2)
WinClose("Total Commander")
If WinExists("Total Commander") Then ProcessClose("totalcmd.exe")
Run(@ScriptDir & "\..\..\totalcmd.exe")

- is it not better and more sure to use processes?

- it is expressly needed a topic about tc addons!

Link to comment
Share on other sites

It's more sure, but TC doesn't save configuration if it's process closed. This is not good.

<{POST_SNAPBACK}>

under configuration you are thinking the pats in tc windows?

if yes, then i have idea: check tc window in autoit_spy and from "Visible Window Text " you can find and save (stringsplit...) the pats to the tc ini configuration

Link to comment
Share on other sites

under configuration you are thinking the pats in tc windows?

Not only, new added tabs also don't save. Sure something also, because some settings TC save instantly, but some not.

if yes, then i have idea: check tc window in autoit_spy and from "Visible Window Text " you can find and save (stringsplit...) the pats to the tc ini configuration

You think this is a "simple and safe" way? :ph34r:

When I make this piece of code I think so: first try to close program with right way, so all settings will save. It safe enough until you have not other windows with the "Total Commnder" in header. ProcessClose was used only as "emergency exit" for rare cases if TC remain.

BTW our both scripts doesn't take attention if more then one copy of TC is open. Although I usually don't open more then one copy...

Link to comment
Share on other sites

Not only, new added tabs also don't save. Sure something also, because some settings TC save instantly, but some not.

You think this is a "simple and safe" way? :ph34r:

When I make this piece of code I think so: first try to close program with right way, so all settings will save. It safe enough until you have not other windows with the "Total Commnder" in header. ProcessClose was used only as "emergency exit" for rare cases if TC remain.

<{POST_SNAPBACK}>

- yes, new tabs save is problem... but have you try to find out if tc saves new tabs in some other file (not in wincmd.ini)?

BTW our both scripts doesn't take attention if more then one copy of TC is open. Although I usually don't open more then one copy...

<{POST_SNAPBACK}>

- with new tabs ability you dont have any reason to open more then one copy of tc, i think...
Link to comment
Share on other sites

  • 2 weeks later...

:ph34r: Hmm... can you explain?

<{POST_SNAPBACK}>

- follow this points:

1.) read the ini value of tabs (with "inirad")

2.) write this value to some ini file (with "iniwrite")

3.) close totalcmd process (with "processclose")

4.) write saved tabs values to the wincmd.ini

5.) start totalcmd again

Link to comment
Share on other sites

IMO too complex :ph34r: All the more TC not save information somewhere instead wincmd.ini. Yes, you can save tabs into file (if you give command for save and select file before :(), then parsing result file... but again, it too complex and I not see real advantages of it.

If you think that using window title not safe - it possible to use classname of window (TTOTAL_CMD), which is unique for TC.

Link to comment
Share on other sites

  • 2 weeks later...

IMO too complex :ph34r: All the more TC not save information somewhere instead wincmd.ini. Yes, you can save tabs into file (if you give command for save and select file before :(), then parsing result file... but again, it too complex and I not see real advantages of it.

If you think that using window title not safe - it possible to use classname of window (TTOTAL_CMD), which is unique for TC.

<{POST_SNAPBACK}>

yes, it is complex...

classname is a good alternative to process...

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...