buymeapc 1 Report post Posted December 22, 2008 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
weaponx 10 Report post Posted December 22, 2008 See @AutoItPID & $CmdLine Share this post Link to post Share on other sites
buymeapc 1 Report post Posted December 22, 2008 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
weaponx 10 Report post Posted December 22, 2008 Run("program.exe " & @AutoitPID) Share this post Link to post Share on other sites
buymeapc 1 Report post Posted December 22, 2008 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
Jos 1,290 Report post Posted December 22, 2008 You forgot to specify the problem you are having. Visit the SciTE4AutoIt3 Download page for the latest versions - Beta files How to post scriptsource Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites
buymeapc 1 Report post Posted December 22, 2008 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
Jos 1,290 Report post Posted December 22, 2008 Why would you need to set the PID of a launched program? Visit the SciTE4AutoIt3 Download page for the latest versions - Beta files How to post scriptsource Forum Rules Live for the present, Dream of the future, Learn from the past. Share this post Link to post Share on other sites
buymeapc 1 Report post Posted December 22, 2008 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
TurionAltec 13 Report post Posted December 22, 2008 (edited) I believe the PID is assigned by the Windows kernel when a new process is created, and can't be user selected. Edited December 22, 2008 by TurionAltec Share this post Link to post Share on other sites