Sign in to follow this  
Followers 0
hades666

ProcessExists Problem

13 posts in this topic

Hello Dear AutoIt Fans

I have a little problem and need your help, if its possible.

First my used AutoIt and Scite Version and Information about OS

AutoIt: 3.2.8.1

Scite: 1.74

OS: Windows 2000 SP4

I wrote a Programm to automate deploymenttasks for an applicationserver.For some cleaning issues i must stop the server. In my programm I use the "ProcessExists()" Command to look first, if the service is running (service runs as system user), then I stop the server.

Code:

If ProcessExists("beasvc.exe") then

blablabla

Endif

What ever, the problem is now, when i run the script with normal User Rights then ProcessExists returns always "0", althougt there is an beasvc.exe Process in the Taskmanager. When i run the script as Administrator, then everything works fine.

When i use the ProcessList() Command it shows me the beasvc.exe process, only with the processexists() command i became allways a "0".

Has anyone an idea what the problem is? Probably it is an privilege Problem. But normaly in Windows 2000 i see all processes both as normal User and Administrator. Only in Vista i need an elevation of the userrights to see all process (maybe in XP also).

Has anyone an Idea?

Thank you for your Help!

Ps. I hope you understand what i mean, then my english is not so good.

Share this post


Link to post
Share on other sites



I believe JPM fixed the Win 2k issue with the Process* functions.

Win 2k truncates at about 15 characters I believe, so if you have a long process name, what you enter for ProcessExists might not be right.

Try updating to the newest release and beta to see if it fixes your issue.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

I believe JPM fixed the Win 2k issue with the Process* functions.

Win 2k truncates at about 15 characters I believe, so if you have a long process name, what you enter for ProcessExists might not be right.

Try updating to the newest release and beta to see if it fixes your issue.

Thank you for your fast reply.

I have forget to say, that i have already testet with the Beta Version 3.2.9.1. With this version i have the same failure. When i use version 3.2.9.2 then the whole program won't run not only processexists. :)

Share this post


Link to post
Share on other sites

Thank you for your fast reply.

I have forget to say, that i have already testet with the Beta Version 3.2.9.1. With this version i have the same failure. When i use version 3.2.9.2 then the whole program won't run not only processexists. ;)

That seems like an issue on your end... :)

Well then, I gave you the answer, now you'll just have to do a custom ProcessExist function and see if it works...

Something like:

Func _ProcessExistsEx($sExe)
    Local $sRegPExist = ProcessExists($sExe)
    If $sRegPExist Then Return $sRegPExist
    If StringLen($sExe) <= 15 Then Return SetError(1, 0, 0)
    Return ProcessExists(StringLeft($sExe, 15))
EndFunc   ;==>_ProcessExistsEx

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

That seems like an issue on your end... :)

Well then, I gave you the answer, now you'll just have to do a custom ProcessExist function and see if it works...

Something like:

Func _ProcessExistsEx($sExe)
    Local $sRegPExist = ProcessExists($sExe)
    If $sRegPExist Then Return $sRegPExist
    If StringLen($sExe) <= 15 Then Return SetError(1, 0, 0)
    Return ProcessExists(StringLeft($sExe, 15))
EndFunc   ;==>_ProcessExistsEx
Nope, it won't work and the processname was never longer than 15 chars. I have also tested now with a Windows standard service "smss.exe" and with my service "beasvc.exe". Both won't run with processexists, when i logged in as an normal user (without admin rights) in windows 2000. So i think it is not the problem with the 15 chars issue. I have only problems with processexists. When i use processlist command, i find all the processes for i searched.

I don't think that is an failure in my program at this time. The compilation gives me no errors. i have also made a little program with your code snippet and i have the same effects whit it.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

ProcessExists works fine for me on Win2k SP4, so unless you can produce a non-working script that can be verified, it's going to have to be considered an issue on your end.

Just noticed you posted this in bug reports, and now see that you are trying to use these functions as two different users :)

Edited by SmOke_N
More Info

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Sorry when i have posted this thread on two different forum.

Here is a little testscript i made. I have also posted it in the Bugs thread. I think it is not a problem of my code. Maybe i have explained my problem not realy clear. Sorry but im not very well in english.

QUELLTEXT

$list = ProcessList("smss.exe")

for $i = 1 to $list[0][0]

msgbox(0,"processlist", $list[$i][0] & " " & $list[$i][1]) ==> result on my PC 692 (command ProcessList find the process)

next

MsgBox(0, "processexists", ProcessExists("smss.exe")) ==> result on my PC 0 (command ProcessExists doesn't find the process)

On this situation something must be wrong whit processexists, because nearly similar commands gives me different output. One find the process the other not in the same program, started with the same user (nonadmin user!) etc. I use autoit in the company where i work, and i have tested the testscript on similar PCs and i become always the same result.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

can you test this with a regular Windows service to see if the same thing happens?

This makes it easier for us to replicate the problem since we don't have this service running which is giving you problems ...

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

You can use the process "SMSS.exe" which i have used in my testscript. This process runs on W2k and XP Versions.

Share this post


Link to post
Share on other sites

With this:

Global $aList, $nPID
ConsoleWrite("OS: " & @OSVersion & " : OS Build: " & @OSBuild & " : OS SP: " & @OSServicePack & @CRLF)

$aList = ProcessList("smss.exe")
If IsArray($aList) Then ConsoleWrite("ProcessList: Name:" & $aList[1][0] & " | PID: " & $aList[1][1] & @CRLF)
If IsArray($aList) Then
    $nPID = ProcessExists("smss.exe")
    ConsoleWrite('ProcessExists: PID: ' & $nPID & @CRLF)
EndIf

I got this:

+>17:14:18 AU3Check ended.rc:0

>Running:(3.2.8.1):C:\Program Files\AutoIt3\autoit3.exe "C:\Dev\AutoIt\Forum\test.au3"

OS: WIN_2000 : OS Build: 2195 : OS SP: Service Pack 4

ProcessList: Name:smss.exe | PID: 140

ProcessExists: PID: 140

+>17:14:18 AutoIT3.exe ended.rc:0

+>17:14:19 AutoIt3Wrapper Finished


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Have you run this script with a user who is a member of the Administrator Group or the Users Group?

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Have you run this script with a user who is a member of the Administrator Group or the Users Group?

Ahh, I had to set up a user group (Have never had a need for one).

Yes, I confirm, ProcessList() works, ProcessExists does return 0.

I suppose you could always make a cheat like I did above until it is looked at by one of the Devs.

Func _ProcessExistsTemp($sExe)
    Local $aPL = ProcessList($sExe)
    If IsArray($aPL) Then Return $aPL[1][1]
    Return 0
EndFunc

You might also link in that bug thread to this posts so JPM can see it confirmed.

Edited by SmOke_N
Suggested Linking from Bug Forum to this post.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Thank you for your help and your Workaround!! About the workaraound, i have already made one. :)

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