BlackDawn187 Posted November 18, 2009 Posted November 18, 2009 (edited) 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 November 18, 2009 by BlackDawn187
CodyBarrett Posted November 18, 2009 Posted November 18, 2009 well for the First Part. while 1 if @Hour < 12 and ProcessExists ('X.exe') then ProcessClose ('X.exe') Sleep (100) Wend would that work? [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size]
BlackDawn187 Posted November 18, 2009 Author Posted November 18, 2009 (edited) 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 November 18, 2009 by BlackDawn187
99ojo Posted November 18, 2009 Posted November 18, 2009 (edited) 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 November 18, 2009 by 99ojo
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now