Author Topic: Set Default Empty File to Edit (Or create key binding?)  (Read 229 times)

indy042

  • New Community Member
  • Posts: 2
  • Hero Points: 0
Set Default Empty File to Edit (Or create key binding?)
« on: April 05, 2018, 01:07:42 am »
Good evening,
I searched through the archives, but didn't see this question. May have missed it. If it has been asked, my apologies...
I create a lot of small .sql files, and instead of selecting the 'Create Empty File to Edit' and selecting PL/SQL, I would make a shortcut that would automagically do it.
I tried creating a key binding in the options but it wouldn't open anything. I then tried what was listed as new-file (ALT+N) and it didn't work either. (Just found out it does work, I just have to already have an empty file opened.)
Is there a way I can set up a binding that will accomplish this without doing the Create Empty File>PL/SQL>OK?

I appreciate the help!
-Andy



Graeme

  • Senior Community Member
  • Posts: 2061
  • Hero Points: 248
Re: Set Default Empty File to Edit (Or create key binding?)
« Reply #1 on: April 05, 2018, 02:23:47 am »
You could try this.  Copy the code to e.g. macros1.e and load it using the load module command on the macro menu.
[BTW my personal opinion is if you haven't found what you're looking for after 10 minutes you should just ask.]

Code: [Select]
#include "slick.sh"

#pragma option(strictsemicolons,on)
#pragma option(strict,on)
#pragma option(autodecl,off)
#pragma option(strictparens,on)

int xx1 = 10000;

_command void new_sql_file() name_info(',')
{
   if ( ++xx1 > 1000000 ) {
      xx1 = 10000;
   }
   if (edit('+t temp' :+ xx1 :+ '.sql'))
   {
      _message_box("Unable to create file");
      return;
   }
   gui_save_as();
   if (_message_box('Add to project?  : ' \n :+ _project_name :+ \n :+ 'File : ' :+ _mdi.p_child.p_buf_name, "new file", MB_YESNO) == IDYES)
   {
      project_add_file(_mdi.p_child.p_buf_name);
   }
}


indy042

  • New Community Member
  • Posts: 2
  • Hero Points: 0
Re: Set Default Empty File to Edit (Or create key binding?)
« Reply #2 on: April 07, 2018, 06:52:39 pm »
Thank you for the help! Looks like I need the pro version to load it. (running the standard version)
I did save this so if I do upgrade down the line, I can give it a whirl.

-Andy
 

Graeme

  • Senior Community Member
  • Posts: 2061
  • Hero Points: 248
Re: Set Default Empty File to Edit (Or create key binding?)
« Reply #3 on: April 07, 2018, 08:37:36 pm »
It looks like the standard edition lets you record a macro so you could try recording a macro that creates a new sql file.