SlickEdit Product Discussion > Slick-C® Macro Programming

Running shell programs

(1/2) > >>

hensh:
The Slick-C code below will not run. However, if Typora.exe is in my PATH, the commented line below works. Why can't Slick-C find 'C:\Program Files\Typora\Typora.exe'? I've tried numerous variations. What am I missing?


--- Code: ---#include "slick.sh"

_command void runtypora() name_info(','VSARG2_READ_ONLY|VSARG2_REQUIRES_EDITORCTL)
{
   if (_no_child_windows()) {
      _message_box("No buffer is open");
      return;
   }
   if (_isno_name(p_DocumentName) || p_buf_name == '') {
      _message_box("No buffer is open");
      return;
   }
   save();
   //shell('Typora ' p_buf_name, 'QA');
   shell('C:\Program Files\Typora\Typora.exe ' p_buf_name,'QA');
}
--- End code ---

Dan:
Try putting double quotes around C:\Program Files\Typora\Typora.exe  since there are space in it.

If you had this in a variable you could use _maybe_quote_filename() around it.  You still could, but since you have a constant, it's easy enough to just quote.

hensh:
This was the first thing I tried.


--- Code: ---shell("C:\Program Files\Typora\Typora.exe " p_buf_name,'QA');
--- End code ---

The macro does not compile and I get a message stating that there is an illegal character with a blinking cursor appearing between the colon and the backslash.

Dan:
Try this:

shell(_maybe_quote_filename('C:\Program Files\Typora\Typora.exe')' 'p_buf_name,'QA');

hensh:
Worked like charm. Thank you. Any idea why your suggestion was necessary?

Navigation

[0] Message Index

[#] Next page

Go to full version