Guest mcleef Posted August 1, 2005 Share Posted August 1, 2005 Dear sir:I encounter a problem on ProcessExists() function, I execute the following codeIf Not ProcessExists("rcHost.exe") Then MsgBox(48, "Message", "rchost Not exist")Else MsgBox(48, "Message", "rchost exist") EndifI have 2 test PCs, one is Window NT workstation, another one isWindows 2000 professional, rchost.exe is started by a automationstart service, and I am sure the rchost.exe is running from task manager.rchost.exe is started by system account on both machine, and when I executethe script on Windows 2000 professional, it will display "rchost exist", but whenI execute it on Windows NT workstation, it will display "rchost Not exist".Then I open a notepad by currnt logon account, and I test another script onthe Windows NT workstation as following:If Not ProcessExists("notepad.exe") Then MsgBox(48, "Message", "notepad.exe Not exist")Else MsgBox(48, "Message", "notepad.exe exist") EndifIt will display "notepad.exe exist"So I think the real problem is the ProcessExists() function can't detecta process which is started by system account on the Windows NT workstation.Could someone kindly give me some comment to solve this problem?I have about 3,000 NT workstation may encounter this kind of problem.Very thanks!!Jo. Link to comment Share on other sites More sharing options...
jpm Posted August 1, 2005 Share Posted August 1, 2005 (edited) did you install AutoIt on these machine or do you run a compile script? under NT AutoIt need to access to psapi.dll. It is mentioned in the doc Edited August 1, 2005 by jpm Link to comment Share on other sites More sharing options...
Guest mcleef Posted August 1, 2005 Share Posted August 1, 2005 Hi JP: Thanks for your response. I run it after compile it, but the problem is still existed. I also find the description about PSAIP.DLL from Help file, but I though the description is for ProcessWaitClose function. Do you think it also OK for my problem? I also try to find PSAIP.DLL, but I can't find it from Internet, do you have any idea ? Thanks!! Jo. Link to comment Share on other sites More sharing options...
LxP Posted August 1, 2005 Share Posted August 1, 2005 (edited) Hi Jo,Here is what I would do if I faced the same situation:Copy the PSAPI.DLL file from AutoIt's folder to the same folder as the uncompiled script.Add If @Compiled Then FileInstall("PSAPI.DLL", @ScriptDir & "\PSAPI.DLL") at the beginning of my script.Add FileDelete(@ScriptDir & "\PSAPI.DLL") at the end of my script.Compile and test.Edit: or you could just place PSAPI.DLL in the same directory as your compiled script and not modify the script. This should also work. Edited August 1, 2005 by LxP Link to comment Share on other sites More sharing options...
jpm Posted August 1, 2005 Share Posted August 1, 2005 (edited) Hi JP:Thanks for your response.I run it after compile it, but the problem is still existed.I also find the description about PSAIP.DLL from Help file, but I though thedescription is for ProcessWaitClose function.Do you think it also OK for my problem?I also try to find PSAIP.DLL, but I can't find it from Internet, do you have any idea ?Thanks!!Jo.<{POST_SNAPBACK}>You already have a psapi.dll in @ProgramFilesDir & "\AutoIt3"If you compile you need to include the PsAPI.dll file with FileInstall(@ProgramFilesDir & "\AutoIt3\psapi.dll", @windir & "\psapi.dll")if your system where you are compiling as a different AutoIt install dir you need to change @ProgramFilesDir & "\AutoIt3 to the specific one. Edited August 1, 2005 by jpm Link to comment Share on other sites More sharing options...
Guest mcleef Posted August 2, 2005 Share Posted August 2, 2005 Hi JP & Lxp: Thanks for your response. It still not works, I change my script as following If @Compiled Then FileInstall("PSAPI.DLL", @WindowsDir & "\PSAPI.DLL") If Not ProcessExists("rcHost.exe") Then IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost Not exist") Else IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost exist") Endif And execute it after compile. I am sure the PSAPI.DLL had copy to @WindowsDir, but it still return "rchost Not exist", and I am sure rchost.exe is existed. Do you have any comment? Jo. Link to comment Share on other sites More sharing options...
LxP Posted August 2, 2005 Share Posted August 2, 2005 Maybe @SystemDir will work better than @WindowsDir?... Link to comment Share on other sites More sharing options...
jpm Posted August 2, 2005 Share Posted August 2, 2005 Hi JP & Lxp:Thanks for your response.It still not works, I change my script as followingIf @Compiled Then FileInstall("PSAPI.DLL", @WindowsDir & "\PSAPI.DLL") If Not ProcessExists("rcHost.exe") Then IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost Not exist") Else IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost exist") EndifAnd execute it after compile.I am sure the PSAPI.DLL had copy to @WindowsDir,but it still return "rchost Not exist", and I am sure rchost.exe is existed.Do you have any comment?Jo.<{POST_SNAPBACK}>I misunderstood your problem. If there was a pb with psapi.dll you should have received a fatalerror popup.As you just get a return = 0 that's something else.Can you run a processlist under NT4 and display all process that's are seen?Thanks Link to comment Share on other sites More sharing options...
Guest mcleef Posted August 3, 2005 Share Posted August 3, 2005 Dear all: My problem is solved. I use the new AutoIT version V3.1.1 to compile my script. If Not ProcessExists("rcHost.exe") Then IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost Not exist") Else IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost exist") Endif The executable file size is about 110K, and same script compile by AutoIT V 3.0.1 only about 84K, I guess the new version had include PSAPI.DLL. Thanks for all your help. Jo. Link to comment Share on other sites More sharing options...
jpm Posted August 3, 2005 Share Posted August 3, 2005 Dear all:My problem is solved.I use the new AutoIT version V3.1.1 to compile my script. If Not ProcessExists("rcHost.exe") Then IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost Not exist") Else IniWrite("C:\Temp\myfile.ini", "section2", "key", "rchost exist") EndifThe executable file size is about 110K, and same script compileby AutoIT V 3.0.1 only about 84K, I guess the new version hadinclude PSAPI.DLL.Thanks for all your help.Jo.<{POST_SNAPBACK}>The psapi.dll is not included in the 110K unless you use Fileinstall.Perhaps a fix has been done in 3.1.0 to have processexists workingThe only reference I can find is related to a modification included in 3.0.102 (Aug 4th, 2004)- Fixed: Process... functions under NT4 unable to see certain processesAt least glad your problem is solved 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