Author Topic: Specify which vs_exe process instance to run macro on?  (Read 710 times)

rowbearto

  • Senior Community Member
  • Posts: 1545
  • Hero Points: 114
Specify which vs_exe process instance to run macro on?
« on: September 27, 2018, 01:34:35 pm »
If I have multiple SE instances running at the same time (+new), and from outside SE I want to trigger the invocation of a macro (vs -#macro), is there a way to specify which instance of SE that the macro should run on? I'm only able to get it to run on the first instance that was launched, but I'd like a way to specify which instance to use (for example provide the pid of the vs instance on the command line).

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4965
  • Hero Points: 410
Re: Specify which vs_exe process instance to run macro on?
« Reply #1 on: September 27, 2018, 04:25:11 pm »
No way to specify which instance yet.

Each platform has a different implementation for this (Windows, Unix, and macOS).

rowbearto

  • Senior Community Member
  • Posts: 1545
  • Hero Points: 114
Re: Specify which vs_exe process instance to run macro on?
« Reply #2 on: September 27, 2018, 05:11:12 pm »
OK - related question, is there a way that I can use _PipeProcess() and get a callback when data is available to be read via _PipeRead()? I'd prefer not to use a timer event to keep CPU utilization lower.

I was thinking that I could have my process invoke a macro on SE to wake it up, however this could fail if I have multiple instances of SE running as the instance of SE to run the macro on can't be specified.

jporkkahtc

  • Senior Community Member
  • Posts: 1864
  • Hero Points: 179
  • Text
Re: Specify which vs_exe process instance to run macro on?
« Reply #3 on: September 28, 2018, 08:01:32 pm »
On Windows at least, from the cmd line:
This will create a new instance named "another"
    vs -sservername another
now,
    vs file1.txt
    vs -sservername another file2.txt
will load file1 into the 1st instance of slick, and file2 into the 2nd instance.

rowbearto

  • Senior Community Member
  • Posts: 1545
  • Hero Points: 114
Re: Specify which vs_exe process instance to run macro on?
« Reply #4 on: September 28, 2018, 08:04:52 pm »
Thanks jporkkahtc!

Is there a way to retrieve the servername that vs was launched with from inside a macro? This way I can launch a macro in SE, start a process (with _PipeProcess) and tell the process which servername (via command line argument) to use for signaling SE to wake up.

Would also be interested to know how to do it in Linux which is where I primarily work.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4965
  • Hero Points: 410
Re: Specify which vs_exe process instance to run macro on?
« Reply #5 on: September 28, 2018, 08:12:10 pm »
Hmm...didn't know about that. Not surprised it works on windows but it seems to work on Linux too. macOs doesn't support the -sservername option. That's probably why it's not documented.