Paste Path from Clipboard into TC and go to folder ('CD')
Moderators: Hacker, petermad, Stefan2, white
- Erik_Rasmussen
- Junior Member
- Posts: 2
- Joined: 2003-02-07, 08:53 UTC
- Location: Copenhagen, Denmark
Hi - one of my PCs is also running NT4WS-SP6a - on this,Valentino wrote:2W!ke
OS is WinNT 4 Workstation SP6a. Didn't change shell, nor installed any command line catchers or smth.
as on my W2K and XP PCs, Explorer is invoked with
the 'argument' as dir, if I just enter, say, "c:\temp" and hit ENTER
Regards
Erik
- Munango-Keewati
- Junior Member
- Posts: 31
- Joined: 2003-02-19, 18:45 UTC
Paste from Clipboard
Thanks to W!ke for pointing me toward vbs. I've never worked with vbs before, but have used vba extensively over the last several years, and it turns out to be fairly close.
What I _really_ wanted to do was copy to the clipboard a drive + path + filename string (in the form C:\path\filename.ext), then have a button or keyboard shortcut set up in TC that would switch one of the directory windows to that directory and locate the file within it.
The following script does all of that on my machine. To work correctly, you have to enable quick search -- letters with dialogue. Of course setups vary a lot in TC, so anyone who wants to try it may need to adjust the script or other settings accordingly. I've only tested it a little, so be cautious; use at your own risk.
Cut the following code and past in a new ASCII document, then save the document under a filename such as paste.vbs. Set up a button bar or keyboard shortcut (not tried yet) to invoke it.
'***************
'Paste filename from clipboard: CD & select file in TC
Set oHtml = CreateObject("htmlfile")
vText = oHtml.ParentWindow.ClipboardData.GetData("text")
If Instr(vText,"\") > 0 then
vPos = InStrRev(vText, "\") + 1
vName = Mid(vText, vPos)
vPos = vPos - 2
vPath = "CD " & Mid(vText, 1, vPos)
set WshShell = WScript.CreateObject("WScript.Shell")
'WshShell.SendKeys "%vr" 'go to right list if using Extended English menu
WshShell.SendKeys "{LEFT}" 'Open/go to command line
WshShell.SendKeys vPath ' change directory
WshShell.SendKeys "~"
WshShell.SendKeys vName 'find file - requires quick search - letters with dialogue
WshShell.SendKeys "{ESC} " 'select file
Else:
MsgBox "No File Path Found on Clipboard."
End If
'*********************
What I _really_ wanted to do was copy to the clipboard a drive + path + filename string (in the form C:\path\filename.ext), then have a button or keyboard shortcut set up in TC that would switch one of the directory windows to that directory and locate the file within it.
The following script does all of that on my machine. To work correctly, you have to enable quick search -- letters with dialogue. Of course setups vary a lot in TC, so anyone who wants to try it may need to adjust the script or other settings accordingly. I've only tested it a little, so be cautious; use at your own risk.
Cut the following code and past in a new ASCII document, then save the document under a filename such as paste.vbs. Set up a button bar or keyboard shortcut (not tried yet) to invoke it.
'***************
'Paste filename from clipboard: CD & select file in TC
Set oHtml = CreateObject("htmlfile")
vText = oHtml.ParentWindow.ClipboardData.GetData("text")
If Instr(vText,"\") > 0 then
vPos = InStrRev(vText, "\") + 1
vName = Mid(vText, vPos)
vPos = vPos - 2
vPath = "CD " & Mid(vText, 1, vPos)
set WshShell = WScript.CreateObject("WScript.Shell")
'WshShell.SendKeys "%vr" 'go to right list if using Extended English menu
WshShell.SendKeys "{LEFT}" 'Open/go to command line
WshShell.SendKeys vPath ' change directory
WshShell.SendKeys "~"
WshShell.SendKeys vName 'find file - requires quick search - letters with dialogue
WshShell.SendKeys "{ESC} " 'select file
Else:
MsgBox "No File Path Found on Clipboard."
End If
'*********************
Last edited by Munango-Keewati on 2003-02-25, 22:00 UTC, edited 1 time in total.
- Munango-Keewati
- Junior Member
- Posts: 31
- Joined: 2003-02-19, 18:45 UTC
Just realized that because I'm using the Extended Menu, the following line won't work or may cause problems:
WshShell.SendKeys "%vr" 'go to right list
So I've commented it out above by adding an apostrophe in front of it. If you're using the Extended Menu, remove the apostrophe at the beginning of the line. Or perhaps someone else can suggest a universal means of transfering the focus to the right window.
WshShell.SendKeys "%vr" 'go to right list
So I've commented it out above by adding an apostrophe in front of it. If you're using the Extended Menu, remove the apostrophe at the beginning of the line. Or perhaps someone else can suggest a universal means of transfering the focus to the right window.
Maybe this would help - http://www.ghisler.ch/board/viewtopic.php?t=271 with cm_focusright or cm_focusleft?
HTH
Roman
HTH
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.
- Munango-Keewati
- Junior Member
- Posts: 31
- Joined: 2003-02-19, 18:45 UTC
I'm afraid I don't follow this at all:Hacker wrote:Maybe this would help - http://www.ghisler.ch/board/viewtopic.php?t=271 with cm_focusright or cm_focusleft?
HTH
Roman
You can send TC the following command:
wm_InvokeMenuCommand=WM_USER+51
with WPARAM set to the command you want to pass to TC.
What is a wm command? What is WPARAM? How do you send such a command to TC? Could you explain for the novice?
Thanks!
Munango-Keewati> What is a wm command? What is WPARAM? How do you send such a command to TC? Could you explain for the novice?
Windows API SendMessage/PostMessage will do the trick here. I've made a program that u can use, its very complicated and I suggest that only people with 1337 programming skillz use it: hWnd Monitor.
Christian, is it possible to get a list of the commands TC will respond to? I like the way Winamp has this documented.
Windows API SendMessage/PostMessage will do the trick here. I've made a program that u can use, its very complicated and I suggest that only people with 1337 programming skillz use it: hWnd Monitor.
Christian, is it possible to get a list of the commands TC will respond to? I like the way Winamp has this documented.
Of all the planets I've been to, this one is my favorite.
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
May I describe my present favorite solution?W!ke wrote:Christian added the new edit path option in tcmd 5.51, please look at the help how this works.
But pasting paths to the commandline is faster, so you can use the following.
- I have a path (or a little worse: path\filename in the clipboard)
- I have cm_EditPath on a funtion key like F2
- I press F2 (EditPath) and paste the path into the titlebar ot the panel
- In case I have to edit the path (take away filename): note the great and efficient possibilities of smart higlighting using Ctlr+CursorKeyLeftRight or Ctlr+Shift+CursorKeyLeftRight (special thanks to ghisler for that).
- Return
This works regardless of your QuickSearch settings!
Werner