Sign in to follow this  
Followers 0
Dethredic

Process Exists Help

21 posts in this topic

i have a script that checks to see if msn is running and if so it does a bunch of things

I have 2 accounts on my computer mine and my little bros.

the script is ment to limit him to 10 minutes on msn per day.

the problem is that if i have msn running in my account (and not the other) the script sees msn as running (when im in the other account) and therefor starts counting down when it shouldn't be.

is there a way i can get the process exist to only check one account to see if a process is running?


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

There are not many built-in solutions in autoit when it comes to processes. I would run a WinExists(" - Conversation") script on his account automatically without the tray icon. Because if he's not talking, it doesn't really matter if he has msn running or not.. Checking the process is not a very good idea.

Edited by Manadar

Share this post


Link to post
Share on other sites

Check the username using something like

if @UserName = "BrothersLogin" then

depending on how you have your code structured.

Share this post


Link to post
Share on other sites

Check the username using something like

if @UserName = "BrothersLogin" then

depending on how you have your code structured.

heres my code

Dim $10Mins = 600000
Global $Timeup
TraySetState(2)

HotKeySet("!^x", "Quit")

Func Quit()
    Exit 0
EndFunc

While 1 
    Sleep(1000)
    If ProcessExists("msnmsgr.exe") Then 
     Call("Timeup")
     Call("Countdown")
EndIf
Sleep(1000)
WEnd

Call("Timeup")


;Countdown 10 Mins

Func Countdown()
    Sleep(1000)
    If ProcessExists("msnmsgr.exe") Then
        Sleep(1000)
        MsgBox(4096 , "Time Limit", "Your 10 Minutes On MSN Is Now Counting Down")
        Do
            If ProcessExists("msnmsgr.exe") Then
            Sleep(1000)
            $10Mins = $10Mins - 1000
            EndIf
        Until $10Mins = 0
    IniWrite( "Log.ini", @MON , @MDAY , "Timeup")
    EndIf
EndFunc


;Kill MSN

Func Timeup()
    $Timeup = IniRead( "Log.ini", @MON , @MDAY , "NotFound")
    If ProcessExists("msnmsgr.exe") Then    
        If $Timeup = "Timeup" Then
            ProcessClose("msnmsgr.exe")
            MsgBox(4096 , "Times Up", "Your 10 Minutes Has Expired, Try Again Tomorrow")
        EndIf
    EndIf
EndFunc

"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

Thanks val


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

dam still doesn't work

starts counting down when msn is only open in my account


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

lol ya


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

can anyone else help??


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

any other ideas at all?


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

none of them work,

help plz


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

You could create a script that lists all of the processes named msnmsgr.exe (ProcessList). Then you'll have to tell the script manually, which one to put the counter on (Use PID's to make the script identify the process.).

You could also do something with the first process that has been run or the second. Just name it.

Edited by Manadar

Share this post


Link to post
Share on other sites

i dont understand

:S


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

tasklist /v /fi "imagename eq msnmsgr.exe" /fo list

process |findstr -i msnmsgr.exe

Both tell you which users are running msn and their PID. Process.exe is not included with Windows but is easily found with Google. If you don't have local admin rights then you cannot get the username of other user processes. I would use StdoutRead to grab the info then StringSplit into an array to isolate the username and PID.

$grab = Run(@ComSpec & ' cmd /c tasklist.exe /v /FI "imagename eq msnmsgr.exe"', @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
While 1
    $stdout = StdoutRead($grab)
    $stderr = StderrRead($grab)
    MsgBox(0, 'OUT', 'stdout: ' & $stdout & @CRLF & 'stderr: ' & $stderr)
    If @error Then ExitLoop
WEnd

If msn isn't running $stderr will contain INFO: No tasks running with the specified criteria. Based on the username and PID you can apply your timer.

Share this post


Link to post
Share on other sites

dont understand anything there,

lol im a noob


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

bodgey no tech way , maybe make your bro's account shortcuts to messanger point to your autoit script instead and let the script launch messenger and doit's countdown thing. Easily bypassed by your bro but a simple bodgey idea.

cheers.

Share this post


Link to post
Share on other sites

ya, good point


"Its not about the 30 inch 1080p display, or the SLI 8800 ultras, or the DDR3 memory. It's about when you turn on your PC, does it return the favor?"Math is like sex. Sure, it may give some practical results, but that is not why we do it

Share this post


Link to post
Share on other sites

tasklist /v /fi "imagename eq msnmsgr.exe" /fo list

process |findstr -i msnmsgr.exe

Both tell you which users are running msn and their PID. Process.exe is not included with Windows but is easily found with Google. If you don't have local admin rights then you cannot get the username of other user processes. I would use StdoutRead to grab the info then StringSplit into an array to isolate the username and PID.

$grab = Run(@ComSpec & ' cmd /c tasklist.exe /v /FI "imagename eq msnmsgr.exe"', @SystemDir, @SW_HIDE, $STDERR_CHILD + $STDOUT_CHILD)
While 1
    $stdout = StdoutRead($grab)
    $stderr = StderrRead($grab)
    MsgBox(0, 'OUT', 'stdout: ' & $stdout & @CRLF & 'stderr: ' & $stderr)
    If @error Then ExitLoop
WEndoÝ÷ Øæ²x¬m®éçx4ß«-uêëÂ)eríj)È4S¢Ö¬Êîx§­Ø^²øuÊâµêâh¬yÚ'¶®±êçjgÓÈ*.q©Ú¦rÊ«¶)¯ú®¢×«Þ~§vØZ¶¬v¬p¢¹(h§ñèçبý½çèºwZéi~)^iº.¶Ø^r¦jwn®

Thanks a lot for the suggestion c0re.

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