Sign in to follow this  
Followers 0
hlmindustries

Need help with my script

7 posts in this topic

I didnt think anything was wrong with it (im very new to scripting this stuff) but it doesnt change priority of $Proc2 or $Proc3

#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.4.7
Author: David Rickard <kingdavera@gmail.com>
Personal modification by: Master <hlmthegod@gmail.com>
Script Function:
Sets the process affinity for the process $Proc to Low.
#ce ----------------------------------------------------------------------------
$Proc1 = "explorer.exe"
$Proc2 = "cstrike.exe"
$Proc3 = "hl.exe"
While 1
If ProcessExists($Proc1) Then
ProcessSetPriority($Proc1, 3)
EndIf
Sleep(1000)
WEnd
While 2
If ProcessExists($Proc2) Then   
ProcessSetPriority($Proc2, 1)
EndIf
WEnd
While 3
If ProcessExists($Proc3) Then
ProcessSetPriority($Proc3, 1)
EndIf
WEnd

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I didnt think anything was wrong with it (im very new to scripting this stuff) but it doesnt change priority of $Proc2 or $Proc3

#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.4.7
Author: David Rickard <kingdavera@gmail.com>
Personal modification by: Master <hlmthegod@gmail.com>
Script Function:
Sets the process affinity for the process $Proc to Low.
#ce ----------------------------------------------------------------------------
$Proc1 = "explorer.exe"
$Proc2 = "cstrike.exe"
$Proc3 = "hl.exe"
While 1
If ProcessExists($Proc1) Then
ProcessSetPriority($Proc1, 3)
EndIf
Sleep(1000)
WEnd
While 2
If ProcessExists($Proc2) Then   
ProcessSetPriority($Proc2, 1)
EndIf
WEnd
While 3
If ProcessExists($Proc3) Then
ProcessSetPriority($Proc3, 1)
EndIf
WEnd

$Proc1 = "explorer.exe"
$Proc2 = "cstrike.exe"
$Proc3 = "hl.exe"
While 1
If ProcessExists($Proc1) Then
ProcessSetPriority($Proc1, 3)
ExitLoop
EndIf
Sleep(1000)
WEnd

While 1
If ProcessExists($Proc2) Then
ProcessSetPriority($Proc2, 1)
ExitLoop
EndIf
WEnd

While 1
If ProcessExists($Proc3) Then
ProcessSetPriority($Proc3, 1)
ExitLoop
EndIf
WEnd

Read in help file about loops.

Edited by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites

Thank you very much! and ill get right on it!

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I didnt think anything was wrong with it (im very new to scripting this stuff) but it doesnt change priority of $Proc2 or $Proc3

#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.4.7
Author: David Rickard <kingdavera@gmail.com>
Personal modification by: Master <hlmthegod@gmail.com>
Script Function:
Sets the process affinity for the process $Proc to Low.
#ce ----------------------------------------------------------------------------
$Proc1 = "explorer.exe"
$Proc2 = "cstrike.exe"
$Proc3 = "hl.exe"
While 1
If ProcessExists($Proc1) Then
ProcessSetPriority($Proc1, 3)
EndIf
Sleep(1000)
WEnd
While 2
If ProcessExists($Proc2) Then   
ProcessSetPriority($Proc2, 1)
EndIf
WEnd
While 3
If ProcessExists($Proc3) Then
ProcessSetPriority($Proc3, 1)
EndIf
WEnd

You have no way to get out of the while/end loops, so it will only set the priority for program 1.

Try this.

$Proc1 = "explorer.exe"
$Proc2 = "cstrike.exe"
$Proc3 = "hl.exe"
Global $p1Set, $p2set, $p3set
While 1
    If ProcessExists($Proc1) And Not $p1Set Then
        ProcessSetPriority($Proc1, 3)
        $p1Set = True
    Else
        $p1Set = False
    EndIf


    If ProcessExists($Proc2) And Not $p2set Then
        ProcessSetPriority($Proc2, 1)
        $p2set = True
    Else
        $p2set = False
    EndIf


    If ProcessExists($Proc3) And Not $p3set Then
        ProcessSetPriority($Proc3, 1)
        $p3set = True
    Else
        $p3set = False
    EndIf

    Sleep(1000)
WEnd
Edited by martin

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

#cs ----------------------------------------------------------------------------
    
    AutoIt Version: 3.2.4.7
    Author: David Rickard <kingdavera@gmail.com>
    Personal modification by: Master <hlmthegod@gmail.com>
    
    Script Function:
    Sets the process affinity for the process $Proc to Low.
    
#ce ----------------------------------------------------------------------------

HotKeySet("{ESC}", "Terminate")

$Proc1 = "explorer.exe"
$Proc2 = "cstrike.exe"
$Proc3 = "hl.exe"

While 1
    If ProcessExists($Proc1) Then
        ProcessSetPriority($Proc1, 3)
        $Proc1 = "" ; it's already done
    EndIf

    If ProcessExists($Proc2) Then
        ProcessSetPriority($Proc2, 1)
        $Proc2 = "" ; it's already done
    EndIf

    If ProcessExists($Proc3) Then
        ProcessSetPriority($Proc3, 1)
        $Proc3 = "" ; it's already done
    EndIf

    If $Proc1 = $Proc2 = $Proc3 Then
        MsgBox(0x0, "Finished", "All process priorities have been set.    ", 5)
        ExitLoop
    EndIf
    
    Sleep(1000)
WEnd

Func Terminate()
    Exit 0
EndFunc   ;==>Terminate

.................... too slow... :P

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I want it to do this constantly, asin never ending, and no popup messages if it did its job, so how do I do this?

EDIT: Martin, I used yours and it appeared to be working properly, thankyou, thank you everyone

Edited by hlmindustries

Share this post


Link to post
Share on other sites

I want it to do this constantly, asin never ending, and no popup messages if it did its job, so how do I do this?

Use Valuater code withou last part:

#cs ----------------------------------------------------------------------------
   
    AutoIt Version: 3.2.4.7
    Author: David Rickard <kingdavera@gmail.com>
    Personal modification by: Master <hlmthegod@gmail.com>
   
    Script Function:
    Sets the process affinity for the process $Proc to Low.
   
#ce ----------------------------------------------------------------------------

HotKeySet("{ESC}", "Terminate")

$Proc1 = "explorer.exe"
$Proc2 = "cstrike.exe"
$Proc3 = "hl.exe"

While 1
    If ProcessExists($Proc1) Then
        ProcessSetPriority($Proc1, 3)
        $Proc1 = ""; it's already done
    EndIf

    If ProcessExists($Proc2) Then
        ProcessSetPriority($Proc2, 1)
        $Proc2 = ""; it's already done
    EndIf

    If ProcessExists($Proc3) Then
        ProcessSetPriority($Proc3, 1)
        $Proc3 = ""; it's already done
    EndIf

    Sleep(1000)
WEnd

Func Terminate()
    Exit 0
EndFunc  ;==>Terminate

When the words fail... music speaks

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