SlickEdit Product Discussion > Slick-C® Macro Programming

is there any way to open a pdf doc from slick c code

(1/1)

Graeme:
Is there any way to open a pdf doc from slick c code?

shell("abc.pdf") doesn't work.

patrick:
I don't see anything that looks up the document type handler outside of some browser specific code.

On Windows you can use shell("start FILENAME"), and on the Linux shell("xdg-open FILENAME").    And it looks like shell("open FILENAME") for OSX.

So something like this:

--- Code: ---   filename := "~/Books/ModernRobotics.pdf";
   cmd := "";
   if (_isWindows()) {
      cmd = 'start';
   } else if (_isLinux()) {
      cmd = 'xdg-open';
   } else {
      cmd = 'open';
   }
   rc := shell(cmd' '_maybe_quote_filename(filename));

--- End code ---


Graeme:
great, thanks.

Navigation

[0] Message Index

Go to full version