Jump to content

Making a Temp Program blocker.. Func isnt working ><


Recommended Posts

Heres My Code:

$HowManyToBlock = InputBox("", "How Many Process's Do You Need To Block?", "", "", -1, 10)
$ProcessKill = InputBox("", "Which Process Would You Like To Block?", "", "", -1, 10)
HotKeySet("+{F1}", "TaskManager")

If $HowManyToBlock = 1 Then
    While 1
    ProcessClose($ProcessKill)
    WEnd
EndIf
If $HowManyToBlock = 2 Then
    While 1
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    WEnd
EndIf
If $HowManyToBlock = 3 Then
    While 1
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    WEnd
EndIf
If $HowManyToBlock = 4 Then
    While 1
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    WEnd
EndIf
If $HowManyToBlock = 5 Then
    While 1
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    WEnd
EndIf

Func TaskManager()
    Opt("SendKeyDownDelay", 100)
    ControlSend("AutoIt Input Box", "How Many Process's Do You Need To Block?", 1002, "^!{DEL}")
    WinWait("Windows Task Manager")
    ControlClick("Windows Task Manager", "Proceses", 1)
    ControlClick("Windows Task Manager", "User Name", 1080)
EndFunc

The problem is, the task manager doesnt show. Anyone know why?

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

If anyone wants to know, prolly dont, but anyways.

Im making this, for like, if you get a virus, then you can atleast block it from poping up new process's every second while your getting rid of it.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

If $HowManyToBlock = 1 Then
    While 1
    ProcessClose($ProcessKill)
    WEnd
EndIf
If $HowManyToBlock = 2 Then
    While 1
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    WEnd
EndIf
If $HowManyToBlock = 3 Then
    While 1
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    WEnd
EndIf
If $HowManyToBlock = 4 Then
    While 1
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    WEnd
EndIf
If $HowManyToBlock = 5 Then
    While 1
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    ProcessClose($ProcessKill)
    WEnd
EndIf
What if I enter 6? :D

There's no real difference between each selection, since you're in an endless loop.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

HI,

what the hell are you trying to do? Your script doesn't make sense this way. :D

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Good point.

well, the reason I wanted the task manager, is for people who dont know about it, and dont know the process name. Yeah, ill get rid of the loops, seeing as I dont need them xD, Oh, and I was going to make a readme thingo telling them the max is 5, or I could just make an error box,

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

I have a virus, I know how to get rid of it.. But anyways...

Just say it runs, then it runs another 4 processes, if you close one, another omes back, thats why you can choose how many to kill, so they all kill quick before it can open another. then youve got time to get rid of it.

# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

Oh, and I was going to make a readme thingo telling them the max is 5, or I could just make an error box,

Since you're in an endless loop, it doesn't matter if the number is 1, 5, or a million.

btw- Task Manager won't launch because you can't Send() Ctrl+Alt+Delete.

Try running Taskman.exe instead.

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Link to comment
Share on other sites

Since you're in an endless loop, it doesn't matter if the number is 1, 5, or a million.

btw- Task Manager won't launch because you can't Send() Ctrl+Alt+Delete.

Try running Taskman.exe instead.

Thanks, ill try that
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

Hi,

or try something like this:

Opt("WinTitleMatchMode", 4)
#include <GUIConstants.au3>
#include <Process.au3>

$GUI = GUICreate("Exit Programm", 233, 251, 192, 125)
;Group
$options_G = GUICtrlCreateGroup("Options", 8, 40, 217, 201)
;RadioButton
$taskkill_R = GUICtrlCreateRadio("Taskkill", 16, 64, 80, 17)
$winClose_R = GUICtrlCreateRadio("WinClose", 16, 88, 80, 17)
$winKill_R = GUICtrlCreateRadio("WinKill", 16, 112, 80, 17)
$processClose_R = GUICtrlCreateRadio("ProcessClose", 16, 136, 80, 17)
$pid_R = GUICtrlCreateRadio("ProcessID", 126, 112, 80, 17)
;Label
$status_L = GUICtrlCreateLabel("Ready...", 16, 216, 203, 17, $SS_SUNKEN)
$headline_L = GUICtrlCreateLabel("Exit Program", 16, 8, 211, 25)
$program_L = GUICtrlCreateLabel("Choose Program", 16, 160, 203, 17, $SS_SUNKEN)
;Button
$Go_B = GUICtrlCreateButton("GO", 126, 64, 89, 30)
;ComboBox
$processCombo_C = GUICtrlCreateCombo("", 16, 184, 201, 21)

GUICtrlSetColor($headline_L, "0xff0000")
GUICtrlSetColor($program_L, "0xff0000")
GUICtrlSetFont($headline_L, 14, 400, "", "Arial")
GUICtrlSetState($processCombo_C, $GUI_FOCUS)
GUISetState(@SW_SHOW)

GUICtrlSetState($taskkill_R, $GUI_CHECKED)

_processCombo()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Go_B
            If GUICtrlRead($taskkill_R) = $GUI_CHECKED Then _taskkill()
            If GUICtrlRead($winClose_R) = $GUI_CHECKED Then _winClose()
            If GUICtrlRead($winKill_R) = $GUI_CHECKED Then _winKill()
            If GUICtrlRead($processClose_R) = $GUI_CHECKED Then _processClose()
            If GUICtrlRead($pid_R) = $GUI_CHECKED Then _killByPID()
        Case $msg = $taskkill_R Or $msg = $processClose_R
            _processCombo()
        Case $msg = $winKill_R Or $msg = $winClose_R
            _winListCombo()
        Case Else
       ;;;;;;;
    EndSelect
WEnd

Func _taskkill()
    $rc = _RunDOS("start taskkill /F /IM " & GUICtrlRead($processCombo_C) & " /T")
    GUICtrlSetData($status_L, "Process " & GUICtrlRead($processCombo_C) & " killed")
    Sleep(2500)
    GUICtrlSetData($status_L, "Ready...")
EndFunc ;==>_taskkill

Func _winClose()
    If WinExists(GUICtrlRead($processCombo_C)) Then
        WinClose(GUICtrlRead($processCombo_C))
    Else
        GUICtrlSetData($status_L, "Window doesn't exist")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    EndIf
EndFunc ;==>_winClose

Func _winKill()
    If WinExists(GUICtrlRead($processCombo_C)) Then
        WinKill(GUICtrlRead($processCombo_C))
    Else
        GUICtrlSetData($status_L, "Window doesn't exist")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    EndIf
EndFunc ;==>_winKill

Func _processClose()
    If ProcessExists(GUICtrlRead($processCombo_C)) Then
        ProcessClose(GUICtrlRead($processCombo_C))
    Else
        GUICtrlSetData($status_L, "Process doesn't exist")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    EndIf
EndFunc ;==>_processClose

Func _killByPID()
    If _ProcessGetName(GUICtrlRead($processCombo_C)) <> '' Then
        $rc = _RunDOS("start taskkill /PID " & GUICtrlRead($processCombo_C) & " /T")
        GUICtrlSetData($status_L, "ProcessID " & GUICtrlRead($processCombo_C) & " - (" & _ProcessGetName(GUICtrlRead($processCombo_C)) & ")" & " killed")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    Else
        GUICtrlSetData($status_L, "ProcessID doesn't exist")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    EndIf
EndFunc ;==>_killByPID

Func _processCombo()
    Dim $processArray = ProcessList()
    For $i = 1 To $processArray[0][0]
        GUICtrlSetData($processCombo_C, $processArray[$i][0])
    Next
EndFunc ;==>_processCombo

Func _winListCombo()
    Dim $windowArray = WinList()
    For $i = 1 To $windowArray[0][0]
   ; Only display visble windows that have a title
        If $windowArray[$i][0] <> "" Then;AND IsVisible($var[$i][1]) Then
            GUICtrlSetData($processCombo_C, $windowArray[$i][0])
        EndIf
    Next
EndFunc ;==>_winListCombo

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

Hi,

or try something like this:

Opt("WinTitleMatchMode", 4)
#include <GUIConstants.au3>
#include <Process.au3>

$GUI = GUICreate("Exit Programm", 233, 251, 192, 125)
;Group
$options_G = GUICtrlCreateGroup("Options", 8, 40, 217, 201)
;RadioButton
$taskkill_R = GUICtrlCreateRadio("Taskkill", 16, 64, 80, 17)
$winClose_R = GUICtrlCreateRadio("WinClose", 16, 88, 80, 17)
$winKill_R = GUICtrlCreateRadio("WinKill", 16, 112, 80, 17)
$processClose_R = GUICtrlCreateRadio("ProcessClose", 16, 136, 80, 17)
$pid_R = GUICtrlCreateRadio("ProcessID", 126, 112, 80, 17)
;Label
$status_L = GUICtrlCreateLabel("Ready...", 16, 216, 203, 17, $SS_SUNKEN)
$headline_L = GUICtrlCreateLabel("Exit Program", 16, 8, 211, 25)
$program_L = GUICtrlCreateLabel("Choose Program", 16, 160, 203, 17, $SS_SUNKEN)
;Button
$Go_B = GUICtrlCreateButton("GO", 126, 64, 89, 30)
;ComboBox
$processCombo_C = GUICtrlCreateCombo("", 16, 184, 201, 21)

GUICtrlSetColor($headline_L, "0xff0000")
GUICtrlSetColor($program_L, "0xff0000")
GUICtrlSetFont($headline_L, 14, 400, "", "Arial")
GUICtrlSetState($processCombo_C, $GUI_FOCUS)
GUISetState(@SW_SHOW)

GUICtrlSetState($taskkill_R, $GUI_CHECKED)

_processCombo()

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $GUI_EVENT_CLOSE
            ExitLoop
        Case $msg = $Go_B
            If GUICtrlRead($taskkill_R) = $GUI_CHECKED Then _taskkill()
            If GUICtrlRead($winClose_R) = $GUI_CHECKED Then _winClose()
            If GUICtrlRead($winKill_R) = $GUI_CHECKED Then _winKill()
            If GUICtrlRead($processClose_R) = $GUI_CHECKED Then _processClose()
            If GUICtrlRead($pid_R) = $GUI_CHECKED Then _killByPID()
        Case $msg = $taskkill_R Or $msg = $processClose_R
            _processCombo()
        Case $msg = $winKill_R Or $msg = $winClose_R
            _winListCombo()
        Case Else
      ;;;;;;;
    EndSelect
WEnd

Func _taskkill()
    $rc = _RunDOS("start taskkill /F /IM " & GUICtrlRead($processCombo_C) & " /T")
    GUICtrlSetData($status_L, "Process " & GUICtrlRead($processCombo_C) & " killed")
    Sleep(2500)
    GUICtrlSetData($status_L, "Ready...")
EndFunc;==>_taskkill

Func _winClose()
    If WinExists(GUICtrlRead($processCombo_C)) Then
        WinClose(GUICtrlRead($processCombo_C))
    Else
        GUICtrlSetData($status_L, "Window doesn't exist")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    EndIf
EndFunc;==>_winClose

Func _winKill()
    If WinExists(GUICtrlRead($processCombo_C)) Then
        WinKill(GUICtrlRead($processCombo_C))
    Else
        GUICtrlSetData($status_L, "Window doesn't exist")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    EndIf
EndFunc;==>_winKill

Func _processClose()
    If ProcessExists(GUICtrlRead($processCombo_C)) Then
        ProcessClose(GUICtrlRead($processCombo_C))
    Else
        GUICtrlSetData($status_L, "Process doesn't exist")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    EndIf
EndFunc;==>_processClose

Func _killByPID()
    If _ProcessGetName(GUICtrlRead($processCombo_C)) <> '' Then
        $rc = _RunDOS("start taskkill /PID " & GUICtrlRead($processCombo_C) & " /T")
        GUICtrlSetData($status_L, "ProcessID " & GUICtrlRead($processCombo_C) & " - (" & _ProcessGetName(GUICtrlRead($processCombo_C)) & ")" & " killed")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    Else
        GUICtrlSetData($status_L, "ProcessID doesn't exist")
        Sleep(2500)
        GUICtrlSetData($status_L, "Ready...")
    EndIf
EndFunc;==>_killByPID

Func _processCombo()
    Dim $processArray = ProcessList()
    For $i = 1 To $processArray[0][0]
        GUICtrlSetData($processCombo_C, $processArray[$i][0])
    Next
EndFunc;==>_processCombo

Func _winListCombo()
    Dim $windowArray = WinList()
    For $i = 1 To $windowArray[0][0]
  ; Only display visble windows that have a title
        If $windowArray[$i][0] <> "" Then;AND IsVisible($var[$i][1]) Then
            GUICtrlSetData($processCombo_C, $windowArray[$i][0])
        EndIf
    Next
EndFunc;==>_winListCombo

So long,

Mega

C:\Documents and Settings\Asus\My Documents\AutoIt\TempBlocker.au3(91,52) : ERROR: _ProcessGetName(): undefined function.
    If _ProcessGetName(GUICtrlRead($processCombo_C))
# MY LOVE FOR YOU... IS LIKE A TRUCK- #
Link to comment
Share on other sites

HI,

that func needs beta.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Link to comment
Share on other sites

I used BETA

Hi,

I don't think so. You have to toggle to beta, beta run or use Scite with Alt+F5.

So long,

Mega

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

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...