How to read the file name under the cursor?

English support forum

Moderators: Hacker, petermad, Stefan2, white

Post Reply
sexy69
Member
Member
Posts: 124
Joined: 2016-06-22, 17:21 UTC

How to read the file name under the cursor?

Post by *sexy69 »

I have code in a VBS script.
There is such a command:
SendKeys "{LEFT}cm_GotoNext{ENTER}"

How to read the file name under the cursor?
File name?????
User avatar
white
Power Member
Power Member
Posts: 5819
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: How to read the file name under the cursor?

Post by *white »

sexy69 wrote: 2022-06-01, 11:25 UTC How to read the file name under the cursor?
File name?????
cm_CopyNamesToClip ?????
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50550
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: How to read the file name under the cursor?

Post by *ghisler(Author) »

You could also send an LB_GETTEXT message to the listbox.
Author of Total Commander
https://www.ghisler.com
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: How to read the file name under the cursor?

Post by *Stefan2 »

sexy69 wrote: 2022-06-01, 11:25 UTC I have code in a VBS script.
There is such a command:
SendKeys "{LEFT}cm_GotoNext{ENTER}"


"SendKeys" just sends a text string.
Do you maybe want to utilize "SendMessage"? (then I would use AutoHotkey instead of VBS)






 
sexy69
Member
Member
Posts: 124
Joined: 2016-06-22, 17:21 UTC

Re: How to read the file name under the cursor?

Post by *sexy69 »

cm_CopyNamesToClip

I used the command to read the clipboard:
txt = Clipboard.GetText

and I can't read directly??


I wrote the code like this:

Uruchom.Run "D:\WinCMD\SendTCCommand.exe cm_GoToFirstFile", vbHide
Sleep 50

Do While True
If Right(tekst, 4) <> ".txt" Then
Uruchom.Run "D:\WinCMD\SendTCCommand.exe cm_GotoNext", vbHide
Sleep 50
Uruchom.SendKeys "{LEFT}cm_CopyNamesToClip{ENTER}"
Sleep 50
tekst = Clipboard.GetText
Else
WScript.Quit
End If
Loop

If the cursor is over the text file, the script will exit
Post Reply