Christopher Blue Posted November 7, 2004 Share Posted November 7, 2004 For the purposes of my AutoIt killer script, I need to know how to find the PID of the script itself so that it may refrain from killing itself until the job is done. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 7, 2004 Developers Share Posted November 7, 2004 For the purposes of my AutoIt killer script, I need to know how to find the PID of the script itself so that it may refrain from killing itself until the job is done.<{POST_SNAPBACK}> I am wondering what the reason for the sudden explosion of post in the "Scripts and Scrapts" forum for regular support is..... Must be 'Script and Scraps" day .... 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...
Christopher Blue Posted November 7, 2004 Author Share Posted November 7, 2004 I must have posted this in the wrong place then. Would an admin please move it to v3 Support? Link to comment Share on other sites More sharing options...
Christopher Blue Posted November 7, 2004 Author Share Posted November 7, 2004 Here is something interesting. I shall read more into it. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 7, 2004 Developers Share Posted November 7, 2004 Here is something interesting. I shall read more into it.<{POST_SNAPBACK}>This should do it:$pid = DllCall("kernel32.dll","int","GetCurrentProcessId") 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...
Christopher Blue Posted November 7, 2004 Author Share Posted November 7, 2004 Thank you JdeB! I tried: $pid = DllCall ( "kernel32.dll", "Int", "GetCurrentProcess", "ptr", "") but it failed probably because I tried passing a parameter. I thought I had to because the DLLCall documentation doesn't list parameters as optional. Link to comment Share on other sites More sharing options...
Developers Jos Posted November 7, 2004 Developers Share Posted November 7, 2004 Thank you JdeB! I tried:$pid = DllCall ( "kernel32.dll", "Int", "GetCurrentProcess", "ptr", "")but it failed probably because I tried passing a parameter. I thought I had to because the DLLCall documentation doesn't list parameters as optional.<{POST_SNAPBACK}>It is optional .....i guess the helpfile should state: DllCall ( "dll", "return type", "function"[, "type", param ]) 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...
Clemens Posted March 26, 2009 Share Posted March 26, 2009 Sry, for this really late thread push ... but it's the only (one line) hint for realise "getting a program's own PID" The code looks really good... but when I've the mini prog $pid = DllCall("kernel32.dll","int","GetCurrentProcessId") sleep(1000) msgbox(0, "my_id", $pid) the result is an empty msgbox any idea? Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted March 26, 2009 Share Posted March 26, 2009 If you want to get the scripts own PID then you can use the macro @AutoItPID MsgBox(0, "", @AutoItPID) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
Clemens Posted March 27, 2009 Share Posted March 27, 2009 Wow, that was easy ... and I didn't find it on my own However... thanks a lot! Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted March 27, 2009 Share Posted March 27, 2009 Wow, that was easy ... and I didn't find it on my own However... thanks a lot! Well to your defence it would have been the twelfth result if you search the helpfile for "pid" BTW if you still want to know why your call to "GetCurrentProcessId" didn't work, then read the "Remarks"-section in the helpfile about DllCall or run this code, I think you will get it. $pid = DllCall("kernel32.dll","int","GetCurrentProcessId") sleep(1000) MsgBox(0, "my_id", "PID from GetCurrentProcessId: " & $pid[0] & @CRLF & "PID from @AutoItPID macro: " & @AutoItPID) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface 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