Control from external program?

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: Hacker, petermad, Stefan2, white

User avatar
Ergo
Senior Member
Senior Member
Posts: 204
Joined: 2003-02-05, 12:20 UTC
Location: Belarus
Contact:

Post by *Ergo »

2SanskritFritz

BTW. Is AHK really better than PowerPro? Currently I use a lot of PowerPro scripts. It substitute a lot of program for me.

But you look so interested in AHK that I wonder if I should look into AHK more closer?
Wincmd.ru WWW.TOTALCMD.NET
I see that future is near...
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

HenrikHusted wrote:It looks like the best solution for me is to use the "/o" parameter to get to the correct directory and then cm_showquickSearch to find the file.

Thanks to all for the quick replies.
Out of couriosity still the question: What will happen next to the file you now have selected in TC? Will you launch it via Buttonbar to another App? Do you want to copy it somewhere? Split the file?

sheepdog
"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
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

2Ergo
As I said, there no big reason to switch to AHK from PP. PP is a magnificent tool for those who are used to it. I am not, I used it for some months, but didnt like it due to the compromises i had to suffer. What I mean by that: yes PP offers StickyNotes, but ATNotes is way better. Yes it offers clipboard history, but CLCL is way better. Yes it offers scripts, but AHK is way better. Yes it offers hotkeys, toolbars etc, but AHK, etc is way better. So just the advantage that i have all these functionalities in one program did not justify PP for me, i have plenty of memory in my PC ;-)
Conclusion: if you like PP, stick to it, but in the meanwhile check out the features of AHK, at first it will seem to be much more narrow than PP, but after you discover the strength of it, you will be amazed.
I switched to Linux, bye and thanks for all the fish!
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

2Sheepdog
Out of couriosity still the question
We asked this several times, but no answer came. Probably not our business.
HenrikHusted you have to understand, we are perfectionist purists ;-)
I switched to Linux, bye and thanks for all the fish!
User avatar
Sheepdog
Power Member
Power Member
Posts: 5150
Joined: 2003-12-18, 21:44 UTC
Location: Berlin, Germany
Contact:

Post by *Sheepdog »

SanskritFritz wrote:no answer came. Probably not our business.
Defenitely not! ;)

But anyway a gnawing sting of curiosity. So I started this last attempt.

sheepdog
"A common mistake that people make when trying to design something
completely foolproof is to underestimate the ingenuity of complete fools."
Douglas Adams
HenrikHusted
Junior Member
Junior Member
Posts: 39
Joined: 2003-03-24, 10:47 UTC

Post by *HenrikHusted »

It's not really a secret why I'm doing this. I have a large database containing filenames and their path, I would like to select one of those files and have tcmd jump that that file.

Now I have tcmd jump to the correct directory (using the "/o" parameter), now I'll have to find a way to jump to the correct file. Using Search is not really an option since it also searches sub directories.
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

Ah i see. I this case, what about filtering the view with the cm_ShowOnlySelected command? First you have to select the file with Ctrl-F12, then issue the cm_ShowOnlySelected command. This way you get some error checking, as if the file does not exist, the view will be empty.
I switched to Linux, bye and thanks for all the fish!
User avatar
gbo
Senior Member
Senior Member
Posts: 329
Joined: 2005-03-31, 19:58 UTC
Location: Lausanne (Switzerland)

Post by *gbo »

It just gave me the idea to use the same concept with locate (cf this thread).

Code: Select all

;Ctrl + F
~^f::
IfWinActive, Locate
{
	;Put highlighted FullFileName in clipboard
	ControlGetFocus, ActiveControl, A
	Send, ^c
	FullFileName = %clipboard%
		
	SplitPath, FullFileName, name, dir
	
	;MsgBox %name%
	;MsgBox %dir%
	
	;FullFileName = C:\My Documents\Address List.txt
	;SplitPath, FullFileName, name, dir, ext, name_no_ext, drive
	; The above will set the variables as follows:
	; name = Address List.txt
	; dir = C:\My Documents
	; ext = txt
	; name_no_ext = Address List
	; drive = C:
	
	;Open TotalCommander with the specified folder
	Run, "C:\Program Files\Totalcmd\Totalcmd.exe"  /o "%dir%"

	Sleep 1000
    
    ;In TC you have to enable [Letters - with search dialog] in preference -> configuration -> operation -> quick search option
    ;Will move to the specified file name
    Send %name%{Escape}
	
	Return
}
Gil
Licence #17346

90% of coding is debugging. The other 10% is writing bugs.
User avatar
Ergo
Senior Member
Senior Member
Posts: 204
Joined: 2003-02-05, 12:20 UTC
Location: Belarus
Contact:

Post by *Ergo »

2SanskritFritz
As I said, there no big reason to switch to AHK from PP. PP is a magnificent tool for those who are used to it. I am not, I used it for some months, but didnt like it due to the compromises i had to suffer. What I mean by that: yes PP offers StickyNotes, but ATNotes is way better. Yes it offers clipboard history, but CLCL is way better. Yes it offers scripts, but AHK is way better. Yes it offers hotkeys, toolbars etc, but AHK, etc is way better. So just the advantage that i have all these functionalities in one program did not justify PP for me, i have plenty of memory in my PC Wink
Conclusion: if you like PP, stick to it, but in the meanwhile check out the features of AHK, at first it will seem to be much more narrow than PP, but after you discover the strength of it, you will be amazed.
And still... what are the advantages of AHK? What AHK can that PP not?
Wincmd.ru WWW.TOTALCMD.NET
I see that future is near...
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Excellent solution, gbo. And it's pretty easy to change that script to send Alt+letter if you need it... ;)

Using Locate plus AutoHotkey is really the best one can do. You only have to make sure that the database is always up-to-date! :)

I really hope that Locate like searching will be implemented in TC one day.

Edit: Corrected the code, now it opens a new tab to circumvent the problem of a running TC that is active in right panel, see bug report here:
http://www.ghisler.ch/board/viewtopic.php?t=9434

Other problem were an empty clipboard, missing focus in Locate, problematic sleep interval and wrongly positioned Return.

Code: Select all

;Ctrl + F
~^f::
IfWinActive, Locate
{
   ;Put highlighted FullFileName in clipboard
   ControlFocus, SysListView321
   Send, ^c
   ClipWait
   FullFileName = %clipboard%

   SplitPath, FullFileName, name, dir

   ;MsgBox %name%
   ;MsgBox %dir%

   ;FullFileName = C:\My Documents\Address List.txt
   ;SplitPath, FullFileName, name, dir, ext, name_no_ext, drive
   ; The above will set the variables as follows:
   ; name = Address List.txt
   ; dir = C:\My Documents
   ; ext = txt
   ; name_no_ext = Address List
   ; drive = C:

   ;Open TotalCommander with the specified folder
   Run, "C:\Program Files\Totalcmd\Totalcmd.exe" /O /T "%dir%"

   WinWaitActive, ahk_class TTOTAL_CMD

    ;In TC you have to enable [Letters - with search dialog] in preference -> configuration -> operation -> quick search option
    ;Will move to the specified file name
    Send, %name%{ESCAPE}

}
Return
Icfu
This account is for sale
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

Before putting something into the clipboard, I recommend to save its previous contents. This is taken from the AHK documentation:

Code: Select all

ClipSaved := ClipboardAll   ; Save the entire clipboard to a variable of your choice.
; ... here make temporary use of the clipboard ...
Clipboard := ClipSaved   ; Restore the original clipboard. Note the use of Clipboard (not ClipboardAll).
ClipSaved =   ; Free the memory in case the clipboard was very large.
I switched to Linux, bye and thanks for all the fish!
User avatar
gbo
Senior Member
Senior Member
Posts: 329
Joined: 2005-03-31, 19:58 UTC
Location: Lausanne (Switzerland)

Post by *gbo »

Thanks for the fine tuning.

Nice to hear that the Encicfupedia find it useful :)
I really hope that Locate like searching will be implemented in TC one day.
So do I, let wait and see...
Gil
Licence #17346

90% of coding is debugging. The other 10% is writing bugs.
User avatar
gbo
Senior Member
Senior Member
Posts: 329
Joined: 2005-03-31, 19:58 UTC
Location: Lausanne (Switzerland)

Post by *gbo »

SanskritFritz wrote:Before putting something into the clipboard, I recommend to save its previous contents. This is taken from the AHK documentation:

Code: Select all

ClipSaved := ClipboardAll   ; Save the entire clipboard to a variable of your choice.
; ... here make temporary use of the clipboard ...
Clipboard := ClipSaved   ; Restore the original clipboard. Note the use of Clipboard (not ClipboardAll).
ClipSaved =   ; Free the memory in case the clipboard was very large.
Yes good advice, I am used to CLCL's convenience... but for people who don't use it, it can be quite frustrating to lose the clipboard's content.
Gil
Licence #17346

90% of coding is debugging. The other 10% is writing bugs.
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Concerning the above AHK script:
It's superfluous!

You can achieve the same goal under Options -> Settings -> Keyboard shortcuts:
1. Activate Ctrl-F
2. Under "Advanced" set to "Local"
3. Under "Where pressed" check "Result list"
4. Action "Advanced"
5. SubAction "Execute command" (not Execute item!)
6. Command "C:\bla bla\totalcmd.exe" "%d"

Icfu
Last edited by icfu on 2006-01-31, 15:31 UTC, edited 1 time in total.
This account is for sale
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

Thanks Icfu! Now we have to find a method to put the cursor onto the file found in Locate. Hmmm... not AutoHotkey again... :-(
I switched to Linux, bye and thanks for all the fish!
Post Reply