Author Topic: How to delete a file from the SlickEdit editor window?  (Read 715 times)

TheHumbleOne

  • Community Member
  • Posts: 43
  • Hero Points: 1
How to delete a file from the SlickEdit editor window?
« on: January 30, 2023, 07:43:18 PM »
Is there a way to delete a currently open file from the SlickEdit editor window? I don't want to do this from the Windows Explorer. Ideally, the "Delete file" command should be available when I right-click on the editor tab of the currently open file.

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2896
  • Hero Points: 153
Re: How to delete a file from the SlickEdit editor window?
« Reply #1 on: January 30, 2023, 08:57:19 PM »
SlickEdit has a delete_file built in.  You can look at the help on it.  It returns a status, you want to pay attention to it because if the file was still open, you may not be able to delete it.

TheHumbleOne

  • Community Member
  • Posts: 43
  • Hero Points: 1
Re: How to delete a file from the SlickEdit editor window?
« Reply #2 on: January 30, 2023, 10:00:14 PM »
How exactly do I run this "delete_file" command?

I tried the following: When the file is open, I press "Escape" key, then type "delete_file" command. I get the "Unknown command" error. There must be another way of running this command; I just don't know what it is.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: How to delete a file from the SlickEdit editor window?
« Reply #3 on: January 31, 2023, 08:24:37 AM »
You have to use minus “-“ instead of underscores ‘_’ when invoking the command from command line.
Or let the command completion kick in by just start typing ‘delete’ and hit TAB or just wait a bit.

TheHumbleOne

  • Community Member
  • Posts: 43
  • Hero Points: 1
Re: How to delete a file from the SlickEdit editor window?
« Reply #4 on: January 31, 2023, 02:08:32 PM »
Even when I issue the "delete-file" command, I get the "Unknown command" error. Here are the steps to reproduce on Windows 10 and the latest version of SlickEdit:
- Create a new file called "testfile.txt" and save it to the disk.
- Hit "Escape" to activate the command window at the bottom
- Type "delete-file" and then "Enter"
- Get "Unknown command" error

Please let me know if you are able to actually a delete a file using this command.

Dan

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2896
  • Hero Points: 153
Re: How to delete a file from the SlickEdit editor window?
« Reply #5 on: January 31, 2023, 02:49:38 PM »
delete_file is a built-in, a function you can only call from Slick-C.  Commands can be called from the SlickEdit command line, or bound to a key.

If you want to delete a file without leaving SlickEdit, you can click on the SlickEdit command line and the bottom of the editor (or press ESC in most emulations), and type "del <filename>".

If you want to delete a file from a macro, it's a bit more involved, but I can help you with that too.