Create file using cm_edit and template parameters

Bug reports will be moved here when the described bug has been fixed

Moderators: white, Hacker, petermad, Stefan2

User avatar
yahuu
Junior Member
Junior Member
Posts: 57
Joined: 2015-01-15, 03:19 UTC

Create file using cm_edit and template parameters

Post by *yahuu »

Create a text file with the content "abcd" as a template, and use the following command to create a new file "x.txt":

Code: Select all

[em_Edit]
cmd=cm_Edit
param=/CL0T="%|COMMANDER_PATH|\USER\TcTemplate\"
The new file "x.txt" contains not only "abcd" but also a lot of garbled characters.

.xlsx also has the same problem. It is not a simple copy of the template. cm_edit adds some unknown content.
User avatar
white
Power Member
Power Member
Posts: 4623
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Create file using cm_edit and template parameters

Post by *white »

Confirmed. It seems an entire sector (4096 bytes in my case) is written.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Create file using cm_edit and template parameters

Post by *ghisler(Author) »

Thanks for your reporting it - I would have appreciated it if you had reported it before the final release, though. Now it will take a long time until the next release.
Btw, the same problem was already in 11.01, but 11.00 seems to work fine(?).
Author of Total Commander
https://www.ghisler.com
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: Create file using cm_edit and template parameters

Post by *JOUBE »

ghisler(Author) wrote: 2023-11-10, 15:39 UTC Thanks for your reporting it - I would have appreciated it if you had reported it before the final release, though. Now it will take a long time until the next release.
Btw, the same problem was already in 11.01, but 11.00 seems to work fine(?).
Yes, it's a shame it wasn't reported earlier. I only discovered this function through this error message and find it useful. A silent update tomorrow or so is not possible (as one of the versions earlier some years ago)? Especially because it apparently already had worked...

Joube
User avatar
yahuu
Junior Member
Junior Member
Posts: 57
Joined: 2015-01-15, 03:19 UTC

Re: Create file using cm_edit and template parameters

Post by *yahuu »

ghisler(Author) wrote: 2023-11-10, 15:39 UTC Thanks for your reporting it - I would have appreciated it if you had reported it before the final release, though. Now it will take a long time until the next release.
Btw, the same problem was already in 11.01, but 11.00 seems to work fine(?).
Sorry because I have been using newfiles.exe to create template files.
I discovered this bug when introducing the tc command parameters to my friends.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Create file using cm_edit and template parameters

Post by *ghisler(Author) »

Sorry for the bug, you will have to use newfiles.exe for a bit longer.

Currently no silent update is planned, maybe I will release a 11.02a version or 11.03.
Author of Total Commander
https://www.ghisler.com
User avatar
white
Power Member
Power Member
Posts: 4623
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Create file using cm_edit and template parameters

Post by *white »

ghisler(Author) wrote: 2023-11-12, 09:51 UTC Currently no silent update is planned, maybe I will release a 11.02a version or 11.03.
The warnings when using the Italian or Norwegian language due to the error in language string 2107 is also a pretty big bug and warrants the release of a new minor release version.
User avatar
tuska
Power Member
Power Member
Posts: 3760
Joined: 2007-05-21, 12:17 UTC

Re: Create file using cm_edit and template parameters

Post by *tuska »

ghisler(Author) wrote: 2023-11-12, 09:51 UTC Currently no silent update is planned, maybe I will release a 11.02a version or 11.03.
version 11.03 please.
TychoBarfy
Senior Member
Senior Member
Posts: 347
Joined: 2005-08-13, 15:13 UTC
Location: Berlin, Germany
Contact:

Re: Create file using cm_edit and template parameters

Post by *TychoBarfy »

Using /T without path as target for the templates, the template files should lie in following folder:

Code: Select all

C:\Users\<USERNAME>\AppData\Roaming\Microsoft\Windows\Templates\
My files in that folder on a system with Libre Office installed are TPL.xltx, TPL.dotx, TPL.potx, TPL.rtf, TPL.ott, TPL.ots, TPL.otp, TPL.odf, TPL.otg and TPL.txt (docx xslx and pptx are created empty even if there is contents in the template).

Commands like follows work with all file extensions except txt (with Libre Office installed):

Code: Select all

[em_open_new_docx_YMDhms]
cmd=cm_edit
param=/CL2 /T /N="%%$DATE:Y-M-D_hms%%.docx"
menu=Edit New DOCX File with Name Y-M-D_hms
For txt I wrote that workaround without edit after file creation:

Code: Select all

[em_open_new_txt_YMDhms]
cmd=%COMSPEC% /c copy /-Y nul
param=%Q"%|$DATE:Y-M-D_hms|.txt"
menu=New text file with name Y-M-D_hms (without template and edit)
A command like this also works with txt files and opens it after creation:

Code: Select all

[em_open_new_txt_name_uc]
cmd=%COMSPEC% /c
param=copy /-Y nul %Q"%O.txt" & %Q"%O.txt"
menu=Edit new text file with name under cursor (without template)
What I discovered was, that using first cm_edit command example:
  • For xlt(x) dot(x) or p0t(x) files it should be real template files with extension xlt(x) dot(x) and pot(x) respectively, even though I don't have MS Office.
  • If I use xls(x) doc(x) or ppt(x), I get a "File corrupted" message from Libre Office when created file is opened.
  • If I create and edit an xlsx on a system with MS Office installed, I get an error message because the created file is 0 byte in size even though template is not. (Libre Office has no problem opening 0 byte files, MSO has.)
  • Libre Office i.e. takes contents of ott when creating odt, but not from otp and ots.
  • When MS Office is installed, all files fail because of the 0 byte sized creation results.
I think, there should be a detailed testing on cm_edit with params in any system condition.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Create file using cm_edit and template parameters

Post by *ghisler(Author) »

The warnings when using the Italian or Norwegian language due to the error in language string 2107 is also a pretty big bug and warrants the release of a new minor release version.
The faulty translations have been there since 11.00, and no one has complained so far. The error is only shown when using any content plugins, so apparently no Italian users used them.
Using /T without path as target for the templates, the template files should lie in following folder:
Both /T with and without path use the same function to copy the template file, so they will both create invalid templates.
Author of Total Commander
https://www.ghisler.com
TychoBarfy
Senior Member
Senior Member
Posts: 347
Joined: 2005-08-13, 15:13 UTC
Location: Berlin, Germany
Contact:

Re: Create file using cm_edit and template parameters

Post by *TychoBarfy »

So you think, it's easy to fix?
User avatar
white
Power Member
Power Member
Posts: 4623
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: Create file using cm_edit and template parameters

Post by *white »

ghisler(Author) wrote: 2023-11-13, 11:12 UTC
The warnings when using the Italian or Norwegian language due to the error in language string 2107 is also a pretty big bug and warrants the release of a new minor release version.
The faulty translations have been there since 11.00, and no one has complained so far. The error is only shown when using any content plugins, so apparently no Italian users used them.
That is a logical fallacy. There may be many reasons why people have not complained so far. Only a small number of people complain, ever, and people may stop using TC because it is so buggy, etc.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Create file using cm_edit and template parameters

Post by *ghisler(Author) »

So you think, it's easy to fix?
Yes, but when I prepare a release 11.03 with beta test it will take again a few months until release. :(
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Create file using cm_edit and template parameters

Post by *petermad »

but when I prepare a release 11.03 with beta test it will take again a few months until release
Just make it a bug-fix - no new features - then the fixes can be confirmed in less than a week.
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
JOUBE
Power Member
Power Member
Posts: 1477
Joined: 2004-07-08, 08:58 UTC

Re: Create file using cm_edit and template parameters

Post by *JOUBE »

white wrote: 2023-11-13, 11:39 UTC...and people may stop using TC because it is so buggy, etc.
...so buggy? No, really not. The mentioned problems can all be easily circumvented by user. No update necessary.
Post Reply