Set TitleBar to ActivePath & Append TC Default Title

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

Moderators: white, Hacker, petermad, Stefan2

User avatar
Hacker
Moderator
Moderator
Posts: 13052
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

jathri,
Well, the issue is the Balderstrom is trying to get the current directory from a specific control but the control names are completely different in the 64-bit version than in the 32-bit version so the current path cannot be read. Why do you need Balderstrom's script if the one you posted works fine? (No idea why that regex would not work for you, though.)

Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

jathri wrote:Description of TF_Find function:

Code: Select all

TF_Find(Text, StartLine = 1, EndLine = 0, SearchText = "", ReturnFirst = 1, ReturnText = 0)

Purpose: Find text using RegExMatch, return line(s), text or lines and text
Parameters: Text, StartLine, EndLine, SearchText, ReturnFirst, ReturnText

TF_Find(Lines) uses Regular Expressions - This means that if you use certain characters which have a special meaning in a RegEx: *\.\?+[{|()^\$** they must be preceded by a backslash to be seen as literal. For example, \. is a literal period and \\ is a literal backslash. Escaping can be avoided by using \Q...\E. For example: \QLiteral Text\E.

ReturnFirst = 0 return multiple lines
ReturnFirst = 1 return first line only

ReturnText = 0 return line numbers only
ReturnText = 1 return entire line (text). This simulates a basic grep feature
ReturnText = 2 return line numbers + entire line (text). This simulates a basic grep feature

MsgBox % TF_Find("File.txt", "", "", "keys") ; return first line number with keys in it
MsgBox % TF_Find("File.txt", "", "", " c[a-z]+s ", 0, 1) ; find all lines with words that start with a c an end with an s
I would like to see Balderstroms script (first post here) fixed. If I rememeber it correctly I used it for a long time with 32-bit version of TC and everything worked flawlessly. I will be grateful for any help he (you - if Balderstrom himself is reading this post) can provide.

Developer Notes:
Change TC_QueryPathA() to the following.

Code: Select all

TC_QueryPathA(wID, byRef pathID="") 
	{
	WinGetText, wText, % "ahk_ID " . wID
	return !(RegExMatch(wText, "mO)^(.*)>$`r`n", gM))?"":gM[1]
	}
* Modified version of Hackers post above.

Given that, the text in TC's window always looks something like this.
And the first line of said text is always the active panel's path delimited with a GreaterThan, with no leading or trailing spaces.
We can match that whole line, just by using the regex above.

Code: Select all

c:\U\TMP>

0 k / 0 k in 0 / 0 file(s)

c:\U\TMP\*.*

[-c-]

[windows]  282,883,432 k of 597,643,260 k free

0 k / 0 k in 0 / 0 file(s), 0 / 13 dir(s)

c:\drivers\*.*

[-c-]

[windows]  282,883,432 k of 597,643,260 k free

[OFFTOPIC RAMBLINGS DELETED]
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
Post Reply