[TC Tool] TC Script Editor

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48021
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Post by *ghisler(Author) »

"InstallDir"="%COMMANDER_PATH%"
Please DON'T do that! It may hang the installer when trying to install newer TC versions from outside of TC...
Author of Total Commander
https://www.ghisler.com
User avatar
Tequilla
Junior Member
Junior Member
Posts: 5
Joined: 2003-08-08, 19:40 UTC

Post by *Tequilla »

Hi,

i'm just trying out TC Script and have some questions. Is it possible to copy date of the day into clipboard to make a directory with it or can i make directories like 1, and if 1 exits it will make a directory 2 and so on with a command in TC to use in TC Script?

I searched in the forum but found nothing to help me.

Thx for answer
Gruss
Tequilla
Alya
Junior Member
Junior Member
Posts: 58
Joined: 2005-01-19, 02:41 UTC

Post by *Alya »

I've created a script to start Total Commander and pop up search dialog box (to search root drive by default):

#include VKeys.h
#define VK_F 70
//define the corresponding 'letter' !!
Exec(TotalCmdExe,"/N");
sleep(500);
//Find TotalCmd's Window handles using our hosts command #0
HostCmd(0);
sleep(500);
PostCmd(cm_SearchFor);
//Search in all drives
SendVKey(VK_TAB,2);
SendVKey(VK_TAB,2);
SendVKey(VK_RETURN,2);
SendVKey(VK_RETURN,2);
//Activate the search field
SendVKey(VK_MENU,1);
SendVKey(VK_F,2);
SendVKey(VK_MENU,0);

It works fine if there is an instance of Total Commander ranning already. But it does not work if Total Commander is not running (e.g. if I'm starting this script by a shortcut from Aston desktop).

What could be the problem?
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

I would recommend to use AutoHotkey instead. It is mighty and more easy to use. And there are already a lot of scipts for TC to use or to learn how to create others.

There is also a tool to convert the scripts to exe-files. THus you don't need to have AutoHotkey installed to run those scripts.

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
Raymond
Senior Member
Senior Member
Posts: 454
Joined: 2003-02-08, 15:43 UTC

Post by *Raymond »

But is there a way to use TC internal commands with AutoHotkey or AutoIt?
Alya
Junior Member
Junior Member
Posts: 58
Joined: 2005-01-19, 02:41 UTC

Post by *Alya »

I spent a lot of time already figuring out TCScript Editor. It's just getting too complicated. Isn't there a simpleway I can launch TC search from Aston desktop without having to first start TC manually?
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

This can be done by this script:

Code: Select all

;TC Search
; adapt the path to Total Commander in the line that begins with 'run'
; YOu don't have to use Quotation marks, even if there is a space in the path name
ifwinexist ahk_class TTOTAL_CMD ; is there already a Instance of TC?
	{
		  IfWinExist ahk_class TFindFile ; is still the searchwindow open ?
				 {
				 winactivate ahk_class TFindFile ; if yes activate
				 return ; and ready
				 }
		else
		{
		Winactivate ahk_class TTOTAL_CMD ; if TC is open but no search window activate TC window
		WinWaitActive ahk_class TTOTAL_CMD  ; Wait till it's active
		PostMessage, 1075, 501, , , ahk_class TTOTAL_CMD ; Send cm_searchfor
		}
	}
else 
	{
	run, totalcmd, c:\total Commander ; run totalcmd 
	Winactivate ahk_class TTOTAL_CMD ;activate TC
	WinWaitActive ahk_class TTOTAL_CMD ; and wait till it's active
	PostMessage, 1075, 501, , , ahk_class TTOTAL_CMD ; send 'cm_SearchFor'
	}
return
As I mentioned, you can compile this script to an Exe file, if you want. Then it's not necessary to have AHK installed.

sheepdog

[edit]

You may navigate in the searchwindow by sending keystrokes e.g.

send, {Tab} c:\+{Tab}
to put in search in: c:\
and return to the search for field

while '+' is the modifier for shift (to send actually '+' you would have to use the sendraw command)
But that you could find in the detailed help
[/edit]
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

Raymond wrote:But is there a way to use TC internal commands with AutoHotkey or AutoIt?
Yes.

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
Raymond
Senior Member
Senior Member
Posts: 454
Joined: 2003-02-08, 15:43 UTC

Post by *Raymond »

Sheepdog wrote:
Raymond wrote:But is there a way to use TC internal commands with AutoHotkey or AutoIt?
Yes.

sheepdog
Could you give an example to show how?
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

If you look at my script you can see it already.
It's the line with
PostMessage, 1075, 501, , , ahk_class TTOTAL_CMD ; Send cm_searchfor

where you send the command number you'll find in totalcmd.inc file. But if you are interested have a look at the TCWiki page . There you can find even a script that sends any command to TC

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
Raymond
Senior Member
Senior Member
Posts: 454
Joined: 2003-02-08, 15:43 UTC

Post by *Raymond »

Thank you, Sheepdog.
I played with AutoHotkey a little tonight. It's really awesome and can do much more. I've transfered all my TC script files to it.
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

It's really awesome and can do much more. I've transfered all my TC script files to it.
Agree, that is what i did too! -)
I switched to Linux, bye and thanks for all the fish!
Alya
Junior Member
Junior Member
Posts: 58
Joined: 2005-01-19, 02:41 UTC

Post by *Alya »

2Sheepdog
Thanks for the script

How do I compile it?
Raymond
Senior Member
Senior Member
Posts: 454
Joined: 2003-02-08, 15:43 UTC

Post by *Raymond »

Alya wrote:How do I compile it?
Use ahk2exe in AutoHotkey package.
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

You can download the Zipped Version of Autohotkey if you dont like to install it. It contains the ahk2exe file that you need to compile the script (as Raymond already stated).

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
Post Reply