Author Topic: Run a macro when SlickEdit starts  (Read 4785 times)


  • Community Member
  • Posts: 8
  • Hero Points: 0
Run a macro when SlickEdit starts
« on: July 15, 2010, 07:56:47 am »

  I am new to SlickEdit world, and I still don't know if what I'm trying to do is possible or not, but I hope that you could help me.
  I am trying to make SlickEdit run a macro that I made each time it opens and I have yet not found a way. Is it possible? And if it is, how can I do that.

 Thanks! :)

ScottW, VP of Dev

  • Senior Community Member
  • Posts: 1471
  • Hero Points: 64
Re: Run a macro when SlickEdit starts
« Reply #1 on: July 15, 2010, 02:30:05 pm »
You can specify a command line argument when you launch SlickEdit from the OS command line. Here is an excerpt from the User Guide (available at Help > Contents). Look in Introduction > Startup and Exit > Invocation Options.

-r cmdline: Execute command with arguments given and remain resident. No other options or file names can be specified after this option since the rest of the command line is assumed to be the program name and space-delimited arguments for this option.

Note that the -r switch must come last!


vs -sc defaultconf +new -r workspace-open c:\dev\foo.vpw


  • Senior Community Member
  • Posts: 162
  • Hero Points: 27
  • Synergex
Re: Run a macro when SlickEdit starts
« Reply #2 on: July 15, 2010, 04:24:41 pm »
In addition to the -r argument is the -# argument, which takes a single command name (that works best without parameters).

vs -sc C:\dev\ +new -#mystartcommand

I went a different route to get the behavior that you're looking for, Paula. I added a call-list to main.e that adds an entry point for your macro to grab onto. It's a bit of a pain since it has to be redone every version, but it works really well.

At the beginning of defmain() in main.e:
Code: [Select]

Then, in your own macro file:
Code: [Select]
#include ""

void _on_slick_open_custom()
    // Do Stuff

Hope this helps!
« Last Edit: July 15, 2010, 06:40:20 pm by MartyL »


  • Senior Community Member
  • Posts: 2727
  • Hero Points: 337
Re: Run a macro when SlickEdit starts
« Reply #3 on: July 16, 2010, 11:34:44 am »
You can also use definit - look it up in slickedit help.

    //  If this is an editor invocation,
    if (arg(1)!="L")  {