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

icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

You can activate that already in Options:

Code: Select all

Activate the first found item after search is completed
This feature is new in 2.99.5.12180, you can get it here:
http://www.uku.fi/~jmhuttun/files/snapshots/?M=D

Icfu
This account is for sale
User avatar
van Dusen
Power Member
Power Member
Posts: 684
Joined: 2004-09-16, 19:30 UTC
Location: Sinzig (Rhein), Germany

Post by *van Dusen »

SanskritFritz wrote:Thanks Icfu! Now we have to find a method to put the cursor onto the file found in Locate. Hmmm... not AutoHotkey again... :-(
Icfu wrote:You can activate that already in Options:

Code: Select all

Activate the first found item after search is completed
[...]
Is it a misunderstandig? However: I still don't know, how I can force TC to jump to a located file without the help of a script :(

If a script is required, here is a solution for AutoIT (nothing new, same concept (using QuickSearch) as gbo and Icfu already had descriped for AutoHotkey). The script works in combination with Icfu's instructions, how to set a shortcut (CTRL+F, for example) to open a folder from within Locate32 :

Code: Select all

;====================================================================================================
;LocateAndJump.au3: Script for AutoIT3 (http://www.autoitscript.com/autoit3/)
;Settings for Locate32:
;Menu Settings, Dialog "Settings:", Tab "Keyboard Shortcuts":
;   Shortcut: Key:                     CTRL + F
;   Advanced: Advanced Settings: Type: Local
;   Where pressed:                     Result list
;   Action: Action:                    Advanced
;   Action: SubAction:                 Execute Command
;   Action: Command: C:\Programme\AutoIt3\AutoIt3.exe C:\Programme\TotalCmd\Tools\LocateAndJump.au3 "%d"
;                    (Locate32 seems not to decode environment variables like "%ProgramFiles%")
;Usage:
;Find a file wth Locate32, press CTRL+F to open the containing dir in TC and to jump to the located file
;====================================================================================================

$fullname = $CmdLine[1]
$fullname_tok = StringSplit($fullname, "")
$filename = $fullname_tok[$fullname_tok[0]]
$pathname = StringLeft($fullname, StringLen($fullname) - StringLen($filename) - 1)

Run(@ProgramFilesDir & "\TotalCmd\TotalCmd.exe /O /T /S /L=" & Chr(34) & $pathname & Chr(34), "")

;*** cm_ShowQuickSearch=2915;Show name search window
Sleep(250)
DllCall("user32.dll", "int", "SendMessage", "hwnd", WinGetHandle("Total Commander"), "int", 1075, "int", 2915)

Send($filename, 1)
Send("{ESC}")
;Send("{SPACE}")

BTW: To open a folder with TC, you can use Settings, Advanced, Use other programs to open folders in Locate32 too.
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

2van Dusen
Ok that's not AutoHotkey :lol:
I'm looking for a way to send a message to TC instructing it to select a particular file, that would be awesome.
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 »

ICFU wrote: Concerning the above AHK script:
It's superfluous!

You can achieve the same goal under ...
It is not the same goal (see video below).

van Dusen wrote: Is it a misunderstandig? However: I still don't know, how I can force TC to jump to a located file without the help of a script Sad
No you right, scripts are still needed if we want to force TC to jump to a located file (with quicksearch).

SanskritFritz wrote: I'm looking for a way to send a message to TC instructing it to select a particular file, that would be awesome.
This is the purpose of the AHK script I proposed a few posts above

You can see the following video to see how it works
locate_ahk_tc_quicksearch.sqx
locate_ahk_tc_quicksearch.zip
Gil
Licence #17346

90% of coding is debugging. The other 10% is writing bugs.
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

2gbo
I am fully aware of what you are saying here. My concern is, that sending keystrokes to an application is not too stable and error proof (just type a character in, or move the focus away). If there is an option, i try to avoid that.
I switched to Linux, bye and thanks for all the fish!
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

@gbo:
You are right, I forgot about those keystrokes. The problem is that I am using Alt+keypress here.
My concern is, that sending keystrokes to an application is not too stable and error proof (just type a character in, or move the focus away). If there is an option, i try to avoid that.
Just fill the quicksearch box with content then (ControlSetText), this is reliable. I have used it in this script:
http://www.ghisler.ch/wiki/index.php/AutoHotkey:_Move_Quicksearch_Box_To_Make_Status_Bar_Visible

You can also lock the keyboard when necessary, see BlockInput.

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 »

2icfu
Good ideas, thanks!
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 »

A slightly optimized version of the script:
http://www.ghisler.ch/wiki/index.php/AutoHotkey:_Locate_in_TC
This does not ruin the clipboard, and cannot be interfered by keypresses, due to the excellent ControlSend and ControlSetText functions.
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 »

An interesting problem occured while trying to rewrite the script: http://www.autohotkey.com/forum/viewtopic.php?t=7796
I switched to Linux, bye and thanks for all the fish!
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

I have added the solution. ;)

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 »

I switched to Linux, bye and thanks for all the fish!
User avatar
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

I like PP syntax more then AHK syntax...

That said, I didn't try PP and I can't beleive that AHK works so perfectly up today.... Even some MS scripting tools like ScriptIt miss its targets all the time, but I didn't have problems with AHK so far... this is one of the best apps I found.

Does PP have the same in-detail API as AHK ?
Habemus majkam!
User avatar
SanskritFritz
Power Member
Power Member
Posts: 3693
Joined: 2003-07-24, 09:25 UTC
Location: Budapest, Hungary

Post by *SanskritFritz »

2majkinetor !
Yeah, I tried other macro tools, but AHK proved to be the most stable and the fastest.
About the syntax:
http://ghisler.ch/board/viewtopic.php?t=6891
I didnt use PP scripting, so i cannot tell much about it. But all my friends that use it, are amazed and would not switch to any other scripting tool, just ask Vochomurka ;-)
I switched to Linux, bye and thanks for all the fish!
icfu
Power Member
Power Member
Posts: 6052
Joined: 2003-09-10, 18:33 UTC

Post by *icfu »

Just watch the impressive AHK forum. The developer fixes bugs faster than ghisler can say "this is by design"... ;)

You have a thread from a dude who switched from PP to AHK here:
http://www.autohotkey.com/forum/viewtopic.php?t=4106&start=0&postdays=0&postorder=asc&highlight=

Icfu
This account is for sale
User avatar
majkinetor !
Power Member
Power Member
Posts: 1580
Joined: 2006-01-18, 07:56 UTC
Contact:

Post by *majkinetor ! »

Thx guys
Habemus majkam!
Post Reply