Author Topic: Button Editor: Create New Text File  (Read 13567 times)

IainC

  • Newbie
  • *
  • Posts: 4
    • View Profile
Button Editor: Create New Text File
« on: November 23, 2019, 12:08:11 »
I would like to have a Button that creates a new, blank, pre-named text file, and which, ideally, then opens in Notepad.  If not the opening bit then, at least, the file would have focus so that I can just press Enter to open it into Notepad from the Explorer Window.  I can do this, almost, bwo a simple Batch File, but I can't eliminate a brief flash of a cmd window.  I know it is possible because I did it ages ago, but then lost that installation of MC (through a corruption of an extension file), and now can't remember how I managed it.  Any pointers would be much appreciated.

Ulfhednar

  • Contributor
  • VIP Member
  • *****
  • Posts: 514
    • View Profile
Re: Button Editor: Create New Text File
« Reply #1 on: November 23, 2019, 16:22:15 »
Shift+F4 brings up a notepad instance.
I think you could script it or use the custom commands feature in the button editor with MC/edit/  etc

Mathias (Author)

  • Administrator
  • VIP Member
  • *****
  • Posts: 4411
    • View Profile
    • Multi Commander
Re: Button Editor: Create New Text File
« Reply #2 on: November 23, 2019, 18:46:55 »
You can type cf <filename> in the command line field to create a empty file with that name

or you can script using MultiScript if you really want a button
Like SaveStringToFile and save and empty string and you get an empty file
« Last Edit: November 23, 2019, 18:52:12 by Mathias (Author) »

IainC

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: Button Editor: Create New Text File
« Reply #3 on: November 27, 2019, 13:43:27 »
Thanks, Mathias.  I haven't ever used MultiScript, so I may need more of a hand-hold: I tried  SaveStringToFile(MyReadMe.txt,"",0); as a User-Created MultiScript Command, which I linked to a Button (but it didn't do anything).

[My Batch File was
call>MyReadMe.txt
start /B  %windir%\notepad.exe MyReadMe.txt
exit
But, as I said, this produces a brief flash of the cmd window]

AlanJB

  • VIP Member
  • *****
  • Posts: 433
  • VERY old Programmer
    • View Profile
Re: Button Editor: Create New Text File
« Reply #4 on: November 27, 2019, 14:47:35 »
Quote
I tried  SaveStringToFile(MyReadMe.txt,"",0)

The first argument needs to be the complete path to the file, including drive and folder(s).