buymeapc Posted December 22, 2008 Share 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? Link to comment Share on other sites More sharing options...
weaponx Posted December 22, 2008 Share Posted December 22, 2008 See @AutoItPID & $CmdLine Link to comment Share on other sites More sharing options...
buymeapc Posted December 22, 2008 Author Share Posted December 22, 2008 I don't understand. How do I launch the secondary application using the PID of the script? Link to comment Share on other sites More sharing options...
weaponx Posted December 22, 2008 Share Posted December 22, 2008 Run("program.exe " & @AutoitPID) Link to comment Share on other sites More sharing options...
buymeapc Posted December 22, 2008 Author Share 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. Link to comment Share on other sites More sharing options...
Developers Jos Posted December 22, 2008 Developers Share Posted December 22, 2008 You forgot to specify the problem you are having. SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
buymeapc Posted December 22, 2008 Author Share 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 Link to comment Share on other sites More sharing options...
Developers Jos Posted December 22, 2008 Developers Share Posted December 22, 2008 Why would you need to set the PID of a launched program? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
buymeapc Posted December 22, 2008 Author Share 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. Link to comment Share on other sites More sharing options...
TurionAltec Posted December 22, 2008 Share 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now