Passing long filenames to editor (F4)
Moderators: white, Hacker, petermad, Stefan2
Passing long filenames to editor (F4)
Hello,
It seems that TC passes short filenames to the editor configured for F4. (i.e. "C:\Program Files\Totalcmd\wincmd.ini" passed as "C:\Progra~1\Totalcmd\wincmd.ini"). While this works perfectly ok under Windows, it is sometimes desirable to have long filename passed in its exact form to the editor (i.e. under Unix with Wine). Is there a way to achieve this with the current version of TC?
Thanks for any help/comments.
It seems that TC passes short filenames to the editor configured for F4. (i.e. "C:\Program Files\Totalcmd\wincmd.ini" passed as "C:\Progra~1\Totalcmd\wincmd.ini"). While this works perfectly ok under Windows, it is sometimes desirable to have long filename passed in its exact form to the editor (i.e. under Unix with Wine). Is there a way to achieve this with the current version of TC?
Thanks for any help/comments.
- Wilhelm M.
- Power Member
- Posts: 996
- Joined: 2003-06-05, 10:45 UTC
- Wilhelm M.
- Power Member
- Posts: 996
- Joined: 2003-06-05, 10:45 UTC
Re: Passing long filenames to editor (F4)
Cant Confirm this for Win Xp SP2....Wisdom wrote:It seems that TC passes short filenames to the editor configured for F4. (i.e. "C:\Program Files\Totalcmd\wincmd.ini" passed as "C:\Progra~1\Totalcmd\wincmd.ini").
Hoecker sie sind raus!
Ok, it seems like a Wine related issue. Thanks for your feedback, guys.
Here is how I "solved" it for now:
I created a small shell script:
#!/bin/sh
emacs `echo $1 | sed 's/U://' | tr '\\\' '/'`
("U:" is the drive that Wine maps to my root (/) filesystem. And "emacs" is obviously my editor of choice.)
I saved that script as:
/home/wisdom/bin/tcedit.sh
I made it executable with:
chmod +x /home/wisdom/bin/tcedit.sh
In TC, I created a button for that script, using "%P%N" as parameters. (Thanks Wilhelm.)
Dragging a file to that button now opens up Emacs as expected.
Just a quick and dirty hack. Please let me know if there is a more decent solution to this. Thanks.
Here is how I "solved" it for now:
I created a small shell script:
#!/bin/sh
emacs `echo $1 | sed 's/U://' | tr '\\\' '/'`
("U:" is the drive that Wine maps to my root (/) filesystem. And "emacs" is obviously my editor of choice.)
I saved that script as:
/home/wisdom/bin/tcedit.sh
I made it executable with:
chmod +x /home/wisdom/bin/tcedit.sh
In TC, I created a button for that script, using "%P%N" as parameters. (Thanks Wilhelm.)
Dragging a file to that button now opens up Emacs as expected.
Just a quick and dirty hack. Please let me know if there is a more decent solution to this. Thanks.
Ok, I just found a decent solution to this problem.
Command-line tool winepath (which comes with Wine package) does the necessary conversion.
So, if you modify the script from my previous post as the following;
#!/bin/sh
emacs `winepath -u "$*"`
and then just define that script as the editor for F4 (i.e. U:\home\wisdom\bin\tcedit.sh, where U: would be a Wine drive mapping to your root (/) filesystem.), it just works.
Command-line tool winepath (which comes with Wine package) does the necessary conversion.
So, if you modify the script from my previous post as the following;
#!/bin/sh
emacs `winepath -u "$*"`
and then just define that script as the editor for F4 (i.e. U:\home\wisdom\bin\tcedit.sh, where U: would be a Wine drive mapping to your root (/) filesystem.), it just works.
- ghisler(Author)
- Site Admin
- Posts: 48096
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
2Wisdom
TC passes short names to the editor if it either cannot check the editor .exe type, or it is a 16-bit program. But there is a workaround: Set the following as the editor command line:
editorname "%1"
The double quotes are important! They tell TC to use long names.
TC passes short names to the editor if it either cannot check the editor .exe type, or it is a 16-bit program. But there is a workaround: Set the following as the editor command line:
editorname "%1"
The double quotes are important! They tell TC to use long names.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Same problem?
Hi
If I use Ultraedit as editor under F4 I run into trouble which I think is related to this the problems discussed in this thread.
The problem occurs when I try to use F4 from inside an archive. TC then asks "Do you want to extract the file and edit it". I confirm and UE is opened with the file. The path to the file in UE is to TC's temporary directory (something like 'C:\DOCUME~1\t716207\LOCALS~1\Temp\_tc_\filename'). Is this related to the long/short name problem?
Everything looks fine. But the problem is that after a few seconds UE tells me that the original file is removed from the disk, and I get an option to save the file under a new name. I guess what happens is that TC deletes the temporary file.
But the strange thin is that if I choose to use Notepad as the editor for F4, everything works. When inside an archive, F4 brings up the "do you want to extract and edit"-dialog. The file opens in Notepad, I edit the file, save and close. TC then asks me if I want to update the archive with the edited file. Everything is just fine.
But I really, really want to be able to use UE as my editor for such operations. I tried to do the "%1"-trick, but it did not work.
Am I missing something here?
Thanks in advance.
If I use Ultraedit as editor under F4 I run into trouble which I think is related to this the problems discussed in this thread.
The problem occurs when I try to use F4 from inside an archive. TC then asks "Do you want to extract the file and edit it". I confirm and UE is opened with the file. The path to the file in UE is to TC's temporary directory (something like 'C:\DOCUME~1\t716207\LOCALS~1\Temp\_tc_\filename'). Is this related to the long/short name problem?
Everything looks fine. But the problem is that after a few seconds UE tells me that the original file is removed from the disk, and I get an option to save the file under a new name. I guess what happens is that TC deletes the temporary file.
But the strange thin is that if I choose to use Notepad as the editor for F4, everything works. When inside an archive, F4 brings up the "do you want to extract and edit"-dialog. The file opens in Notepad, I edit the file, save and close. TC then asks me if I want to update the archive with the edited file. Everything is just fine.
But I really, really want to be able to use UE as my editor for such operations. I tried to do the "%1"-trick, but it did not work.
Am I missing something here?
Thanks in advance.
- ghisler(Author)
- Site Admin
- Posts: 48096
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
TC apparently thinks that the editor closes, and immediately deletes the temporary files. This happens with some editors which have a launcher, e.g. uedit.exe launching the actual editor ultraedit.exe (that's just an example, I don't know whether this really happens here or not), or when you use a multiple document interface and the editor is already running.
Normally TC then shows a dialog box which asks the user to press a button when the editor has been closed. This function will not work if
1. you have an old TC version, or
2. disabled this feature via the ini, or
3. the editor takes several seconds to start.
Normally TC then shows a dialog box which asks the user to press a button when the editor has been closed. This function will not work if
1. you have an old TC version, or
2. disabled this feature via the ini, or
3. the editor takes several seconds to start.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
Thanx
Hi
Thanks for the post, Mr. Ghisler. The problem was that I only allow UE to run one instance. If I allow UE to run multiple instances, the file opened from TC will open in a new instence of UE. I can the edit the file, save and close and TC then asks me if I want to repack the file and everything is just fine.
But which feature do you talk about in your post under 2.? And which dialog box are you referring to?
I just want to do some more testing, since I really do not want to have new instances of UE every time I open a file from TC.
Thanks for the post, Mr. Ghisler. The problem was that I only allow UE to run one instance. If I allow UE to run multiple instances, the file opened from TC will open in a new instence of UE. I can the edit the file, save and close and TC then asks me if I want to repack the file and everything is just fine.
But which feature do you talk about in your post under 2.? And which dialog box are you referring to?
I just want to do some more testing, since I really do not want to have new instances of UE every time I open a file from TC.
2bdk
From the Help file section 4b (wincmd.ini):But which feature do you talk about in your post under 2.?
EditWaitTime=2 Timeout value when editing files from an archive or ftp server: If an editor closes within this amount of seconds, assume that it's a multiple document editor and show dialog where user can confirm when editing has ended.
Set to 0 to turn off this feature.
Set to -1 to not show this dialog at all (e.g. when the file was passed via DDE to the associated program).
http://madsenworld.dk/tcmd/closetemp.pngAnd which dialog box are you referring to
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Problem solved!!
Thanx for the post. Now I finally got things working the way I wanted.
Setting EditWaitTime to something else than -1 did the trick.
Now TC and UE are working hand in hand like a charm.
Setting EditWaitTime to something else than -1 did the trick.
Now TC and UE are working hand in hand like a charm.
if you are using a mac and also want to be able to use f4 as an editor with a native editor and CrossOver you can do as follows:
- create a shell script as Wisdom does
- paste the following:
- note that the command is all in one line
- i am using textmate but you can of course use any editor
- call your script with "%1" as christian posted earlier
cheers,
alex
- create a shell script as Wisdom does
- paste the following:
Code: Select all
#!/bin/bash
FILE=`/Applications/CrossOver.app/Contents/SharedSupport/CrossOver/bin/wine --wl-app /Applications/CrossOver.app/Contents/SharedSupport/CrossOver/lib/wine/winepath.exe.so -u $1`
/usr/bin/mate "$FILE"
- i am using textmate but you can of course use any editor
- call your script with "%1" as christian posted earlier
cheers,
alex