 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Mon Nov 13, 2006 3:10 pm Post subject: Function: Set the File Name in Total Commander 7 |
|
|
To test it open the TC and execute the script. Press ALT M to open input box. Type a file name in any panel to select it.
| Code: | !m::
InputBox fn, ,type a file name to select
if errorlevel != 1
if !SetTCFileName(fn, "right", 1)
SetTCFileName(fn, "left", 1)
return
;--------------------------------------------------------------------
; PURPOSE: Set the focus to given file name
;
; ARGS:
; FN - file name to set
; panel - panel in witch file resides (1=right=default, 2=left)
; select - true to select, false=default
;
; RETURNS : true if file was found
;
SetTCFileName( fn, panel="", select=false )
{
static sss, LB_SETCARETINDEX, LB_GETTEXT
;initialise
if LB_SETCARETINDEX=
{
LB_SETCARETINDEX = 0x19E
LB_GETTEXT = 0x189
VarSetCapacity(sss, 512)
}
;check active TC panel
GetTCPanels( pLeft, pRight)
cur := GetCurrentTCDir()
if (cur = pLeft)
if (panel = "right")
Send {TAB}
if (cur = pRight)
if (panel = "left")
Send {TAB}
if (panel = "right") or (panel="")
panel = TMyListBox1
else panel = TMyListBox2
loop
{
SendMessage LB_GETTEXT, A_Index, &sss, %panel%, ahk_class TTOTAL_CMD
if sss=
return 0
if (sss = fn)
{
SendMessage LB_GETTEXT, A_Index+1, &sss, %panel%, ahk_class TTOTAL_CMD
SendMessage, LB_SETCARETINDEX, A_Index, 1, %panel%, ahk_class TTOTAL_CMD
break
}
}
if (select)
{
Send, {INSERT}
if sss !=
Send,{UP}
}
return 1
}
;--------------------------------------------------------------------------
; set left and right panel
;
GetTCPanels( ByRef pLeft, ByRef pRight)
{
ControlGetText pLeft, TMyPanel5, ahk_class TTOTAL_CMD
ControlGetText pRight, TMyPanel9, ahk_class TTOTAL_CMD
StringReplace pLeft, pLeft, \*.*
StringReplace pRight, pRight, \*.*
}
;--------------------------------------------------------------------------
GetCurrentTCDir()
{
ControlGetText src, TMyPanel2, ahk_class TTOTAL_CMD
StringReplace src, src, >
return src
} |
_________________

Last edited by majkinetor on Tue Nov 14, 2006 8:48 am; edited 1 time in total |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Nov 13, 2006 6:49 pm Post subject: |
|
|
Good idea, but it doesn't work for me with Windows Commander 3.52. (Quite old, I know.)
Where did you get the values for LB_SETCARETINDEX, LB_GETTEXT? Maybe I can get it working with WC 3.52. |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Nov 13, 2006 6:53 pm Post subject: |
|
|
Ok, I did it. Here it is if you want to include it in your script to support windows commander too:
ahk_class has to be changed to TWINDOWSCMD.
TMyListBox1/2 is reversed. The right one is TMyListBox1 |
|
| Back to top |
|
 |
TucknDar
Joined: 07 Jan 2006 Posts: 47 Location: Oslo, Norway
|
Posted: Mon Nov 13, 2006 7:28 pm Post subject: |
|
|
| Anonymous wrote: | | Good idea, but it doesn't work for me with Windows Commander 3.52. (Quite old, I know.) |
Out of curiousity, why do you use this old version?  |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Nov 13, 2006 7:46 pm Post subject: |
|
|
Because it's installed on my machine, does what I want and I'm too lazy to download a newer version.  |
|
| Back to top |
|
 |
TucknDar
Joined: 07 Jan 2006 Posts: 47 Location: Oslo, Norway
|
Posted: Mon Nov 13, 2006 7:53 pm Post subject: |
|
|
| Anonymous wrote: | Because it's installed on my machine, does what I want and I'm too lazy to download a newer version.  | OK, thanks for satisfying my curiosity. You're missing some cool features though  |
|
| Back to top |
|
 |
Guest
|
Posted: Mon Nov 13, 2006 8:47 pm Post subject: |
|
|
| Like what? Any examples? |
|
| Back to top |
|
 |
majkinetor ! Guest
|
Posted: Mon Nov 13, 2006 11:38 pm Post subject: |
|
|
Like too many things to be mentiond here
I am not sure how it works for you. This is using feature of TC7. Before v7 TC didn't recognise LM messages. |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 4511 Location: Belgrade
|
Posted: Tue Nov 14, 2006 8:48 am Post subject: |
|
|
Function is polished a little _________________
 |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|