Jump to content

processexists and process close under win2000


Recommended Posts

I am having an issue getting the commands processexists and processclose to actually close a process. here is the code that I have, but it is not doing anything:

If ProcessExists ("Restore Transmitter to Service2.exe") Then
       Processclose ("Restore Transmitter to Service2.exe")
    Else
    EndIf

I cannot seem to get this to work. Any ideas?

Link to comment
Share on other sites

I am having an issue getting the commands processexists and processclose to actually close a process. here is the code that I have, but it is not doing anything:

If ProcessExists ("Restore Transmitter to Service2.exe") Then
       Processclose ("Restore Transmitter to Service2.exe")
    Else
    EndIf

I cannot seem to get this to work. Any ideas?

First why do you have that Else statement when nothing should be done if it doesn't exist?

Second try print out a msgbox if it exist to see if the problem is by closing or detecting the process..

Regards

Link to comment
Share on other sites

First why do you have that Else statement when nothing should be done if it doesn't exist?

Second try print out a msgbox if it exist to see if the problem is by closing or detecting the process..

Regards

Oh ok I thought I needed the else statement. I did try the msg box... actually I used the script that is in the help file. But it did not work, so I am thinking that it has something to do with detecting the process.

Link to comment
Share on other sites

Maybe you could try using this:

$list = ProcessList("notepad.exe")
If @error Then
    Exit
Else
    for $i = 1 to $list[0][0]
        msgbox(0, $list[$i][0], $list[$i][1])
        
        $PID = $list[$i][1]
        
        ProcessClose($PID)
    next
EndIf

Then it serach the processes for that name and then close all the processes with the PID insted of the name, maybe it works..

Regards

Link to comment
Share on other sites

I think Win2000 truncates the process name to 11 characters or something like that... look in "Task Manager"... use an if statement on @OSVersion (or whatever) to use full name or 11 leftmost characters.

Lar.

Im not sure I follow what you are referring to with the if statement. Could you explain please thanks.

Link to comment
Share on other sites

Im not sure I follow what you are referring to with the if statement. Could you explain please thanks.

If @OSVersion = "WIN_2000" The $Process_Name = StringLeft($Process_Name, 11)

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

If @OSVersion = "WIN_2000" The $Process_Name = StringLeft($Process_Name, 11)
So something like this:

If @OSVersion = "WIN_2000" The $Process_Name = StringLeft($Process_Name, 11)
    If ProcessExists ("Restore Transmitter to Service2.exe") Then
       Processclose ("Restore Transmitter to Service2.exe")
    Else
    EndIf
Link to comment
Share on other sites

So something like this:

If @OSVersion = "WIN_2000" The $Process_Name = StringLeft($Process_Name, 11)
    If ProcessExists ("Restore Transmitter to Service2.exe") Then
       Processclose ("Restore Transmitter to Service2.exe")
    Else
    EndIf
$Process_Name = "Restore Transmitter to Service2.exe"
If @OSVersion = "WIN_2000" The $Process_Name = StringLeft($Process_Name, 11)
If ProcessExists($Process_Name) Then ProcessWaitClose($Process_Name)

To see exactly what processes are running (and what their names are) just use the example in ProcessList(). That will tell you if Lar is correct that it's 11 characters or if it's some other number.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Actually I just looked this up for Win 2000 and it's going to be a bit more complicated than it would first appear. Larry is partially correct in that the process name is truncated and he is close on the number of characters. Spaces and periods (possibly others) in the process name throw it off. It also appears that in any event Win2k will truncate to 15 bytes.

In your case it will be truncated to something like "Restore Tran" Which is 11 Alpha/Num characters + the space. I'm not sure that you can handle it by any method other than getting the PID of the process and using that.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Actually I just looked this up for Win 2000 and it's going to be a bit more complicated than it would first appear. Larry is partially correct in that the process name is truncated and he is close on the number of characters. Spaces and periods (possibly others) in the process name throw it off. It also appears that in any event Win2k will truncate to 15 bytes.

In your case it will be truncated to something like "Restore Tran" Which is 11 Alpha/Num characters + the space. I'm not sure that you can handle it by any method other than getting the PID of the process and using that.

ok. let me try that.

Link to comment
Share on other sites

  • Moderators

I think the issue here is that Ravel is still using 3.1 and is having issues with stuff (no kidding).

http://www.autoitscript.com/forum/index.ph...sExistsex\

Ravel, upgrade to the current versions of AutoIt if you are going to need support. The oldest version I have anymore is 3.2.10 (well, I have them all (installers) I think, but the oldest installed).

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.

Link to comment
Share on other sites

I think the issue here is that Ravel is still using 3.1 and is having issues with stuff (no kidding).

http://www.autoitscript.com/forum/index.ph...sExistsex\

Ravel, upgrade to the current versions of AutoIt if you are going to need support. The oldest version I have anymore is 3.2.10 (well, I have them all (installers) I think, but the oldest installed).

Hmm... I didnt realize that could be a problem. i will do that when I get to my home pc (at work). Because I cant download here. it sux I know. But thanks for the heads up on that. Hopefully it will solve the problem. The one I currently have installed is 3.2.0.1

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...