Jump to content
Sign in to follow this  
BlackDawn187

Personal Firewall?

Recommended Posts

BlackDawn187

So Im trying to write a script that uses the @Hour macro so that at certain times of the day Program X.exe will be allowed to run, im clueless(aka temporary brain fart) right now and need my fellow coders help.

So I want Program X.exe to be able to be run from 12 to 24 but from 1 to 12 it shouldnt be allowed to run. Should also use a ProcessExist("ProgramX.exe) Then "kill it" during times its not allowed to be run.

Sounds simple but I havnt worked with the time macros before and am completely brain dead atm.

Any help is appreciated, ty. Also the reason im using a local script vs using my routers firewall is because the router is accessable by numerous people and is easy to bypass. I could also run a batch file + task scheduler but I want to use a autoit script just cuz.

P.S - Would also be nice to have a multi key hotkey so that I can walk up to the computer press a combo of keys and temporarily allow Program X.exe to run until I come back and press another combo of keys to block Program X.exe.

Edited by BlackDawn187

Share this post


Link to post
Share on other sites
CodyBarrett

well for the First Part.

while 1
if @Hour < 12 and ProcessExists ('X.exe') then ProcessClose ('X.exe')
Sleep (100)
Wend

would that work?

Share this post


Link to post
Share on other sites
BlackDawn187

well for the First Part.

while 1
if @Hour < 12 and ProcessExists ('X.exe') then ProcessClose ('X.exe')
Sleep (100)
Wend

would that work?

Its a nice start,

I want X.exe to be allowed only after 12 and not after 24.

If @Hour > 12 Then Sleep 
Else
If @Hour < 24 Then 
 If ProcessExists('X.exe') Then ProcessClose ('X.exe')
EndIf
EndIf
EndIf

This should work as long as theres no syntax errors

Next thing is to find out how to use mutliple keys for a hotkey

Edited by BlackDawn187

Share this post


Link to post
Share on other sites
99ojo

Its a nice start,

I want X.exe to be allowed only after 12 and not after 24.

If @Hour > 12 Then Sleep 
Else
If @Hour < 24 Then 
 If ProcessExists('X.exe') Then ProcessClose ('X.exe')
EndIf
EndIf
EndIf

This should work as long as theres no syntax errors

Next thing is to find out how to use mutliple keys for a hotkey

Hi,

1) There syntax and logical errors:

If @Hour >= 12 Then 
    Sleep (5000) ; you may change sleeptime
Else
    If ProcessExists('X.exe') Then ProcessClose ('X.exe')
EndIf

2) See helpfile HotKeySet ()

;-))

Stefan

P.S: Here it is:

HotKeySet ("+{ESC}", "_allow") ; Hotkey Shift Esc

$ballow = True
While 1
    If $ballow Then _checkprocess ()
    sleep (1000) ; slow down CPU
Wend

Func _checkprocess ()
    If @Hour >= 12 And @HOUR < 24 Then 
        Sleep (5000)
    Else
        If ProcessExists('X.exe') Then ProcessClose ('X.exe')
    EndIf
EndIf

Func _allow ()
    $ballow = Not $ballow
EndFunc
Edited by 99ojo

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.