Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command Line Parms: Detect Existing Process #6

Open
lmstearn opened this issue May 10, 2019 · 0 comments
Open

Command Line Parms: Detect Existing Process #6

lmstearn opened this issue May 10, 2019 · 0 comments

Comments

@lmstearn
Copy link
Owner

lmstearn commented May 10, 2019

To repro,

  1. Configure two Notepad Prgs, one wide, one ANSI, as described in Help: Getting Started, and add them to a Batch Preset.
  2. Name the Preset "Notepad" and click "This Preset at Load."
  3. Quit PrgLnch, closing all instances of Notepad.
  4. Then launch a new instance of Notepad by editing any small file.
  5. Start PrgLnch, and find in the Prg Status List an active entry for each Notepad,
  6. By cancelling one, the other entry in the list will also become inactive.

To the rescue is code from an old AHK thread that will do the task:

for Item in ComObjGet( "winmgmts:" ).ExecQuery("Select * from Win32_Process")

{

Commandline := Item.Commandline

StringReplace Parameters, Commandline, % Item.ExecutablePath

StringReplace Parameters, Parameters, ""

` if (Trim(Parameters) <> "")

MsgBox % "Name: " Item.Name "nnParameters: " Parameters
}

To implement. consider a policy typed option in which the command line options of an existing Prg process are required, or no. Looks to be somewhat out of the scope of PrgLnch in any case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant