Sign in to follow this  
Followers 0
buymeapc

PID Transfer?

10 posts in this topic

Is there a way to launch a script, set the current PID of that script to a variable and launch another application using that PID in the variable?

Share this post


Link to post
Share on other sites



See @AutoItPID & $CmdLine

Share this post


Link to post
Share on other sites

I don't understand. How do I launch the secondary application using the PID of the script?

Share this post


Link to post
Share on other sites

Run("program.exe " & @AutoitPID)

Share this post


Link to post
Share on other sites

Sorry, but I can't quite get that to work. I'm trying it with notepad and it wants to open a document with the PID as the name.

I have 1 exe which calls a second exe to run the program with that PID

MsgBox(0, "", @AutoItPID)
Run(@ScriptDir&"\Test1.exe" & " " & @AutoItPID)
While 1
    Sleep(100)
WEnd

MsgBox(0, "", $CMDLine[1])
ProcessClose("test.exe")
Run("c:\windows\notepad.exe"& " " & $CMDLine[1], @WindowsDir)

Keeping it very simple right now.

Share this post


Link to post
Share on other sites

Oh, sorry. The problem is that I am trying to launch an exe with the same PID as the AutoIt script.

Basically:

Launch script>set AutoIt PID to variable>close script (so identical PID can be launched)>launch exe with PID from AutoIt Script

Share this post


Link to post
Share on other sites

I'm using an HTPC front end (Meedio). There is only 1 screen file for a module that I want to launch multiple programs from. So, I thought I'd use a script to be called from that screen file which, depending on the parameters sent from the front end, would call the correct program. The screen file talks to the applications PID that is launched from it. If I can have this launch the script and set the program's PID to that of the script's, then I can accomplish my goal - launch multiple programs from 1 screen file. I've tried doing it using the internal code of Meedio and have had no luck, so I thought I'd do it this way instead.

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

I believe the PID is assigned by the Windows kernel when a new process is created, and can't be user selected.

Edited by TurionAltec

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0