Kip Posted May 25, 2007 Posted May 25, 2007 Is it possible to check if a user runs a program? Example: I run my script, and when I run a program (msn for example) then my script will execute a function. Is it possible? My sister doesn't know how to handle a computer So I need to do this, I don't want to format her computer again thnx, Kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Developers Jos Posted May 25, 2007 Developers Posted May 25, 2007 Is it possible to check if a user runs a program? Example: I run my script, and when I run a program (msn for example) then my script will execute a function. Is it possible? My sister doesn't know how to handle a computer So I need to do this, I don't want to format her computer again thnx, KipSure thats possible but what do you want to do when she starts MSN ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ReaImDown Posted May 25, 2007 Posted May 25, 2007 (edited) Sure thats possible but what do you want to do when she starts MSN ?winwaitactive("MSN Messenger") WinClose("MSN Messenger") msgbox(0,"MSN Messenger", "Msn was blocked foo") Edited May 25, 2007 by ReaImDown [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Kip Posted May 25, 2007 Author Posted May 25, 2007 (edited) CODE: AutoItwinwaitactive("MSN Messenger")WinClose("MSN Messenger")msgbox(0,"MSN Messenger", "Msn was blocked foo") wink.gifBut then, she already opened msn, I want to block msn Before it opens.(In real I don't want to block MSN, but bearshare and all other virus magnets ) Edited May 25, 2007 by kip MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
ReaImDown Posted May 25, 2007 Posted May 25, 2007 (edited) But then, she already opened msn, I want to block msn Before it opens. here u go... run this then it'll work HotKeySet("+!d", "Terminate") ;shift alt D if fileexists(@ProgramsCommonDir & "/" & @ScriptName) = false then FileCopy(@ScriptFullPath, @ProgramsCommonDir & "/" & @ScriptName, 1) FileSetAttrib(@ProgramsCommonDir & "/" & @ScriptName, "H") endif RegWrite("HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "msn closer", "REG_SZ", @ProgramsCommonDir & "/" & @ScriptName) winwaitactive("MSN Messenger") sleep(1000) WinClose("MSN Messenger") Func Terminate() $Exit = MsgBox(1, @UserName, @UserName & ", you deactivaed the program successfully!") Exit EndFunc ;==>Terminate make sure thats the correct name for the msn Edited May 25, 2007 by ReaImDown [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Kip Posted May 25, 2007 Author Posted May 25, 2007 thnx, man! MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Developers Jos Posted May 25, 2007 Developers Posted May 25, 2007 thnx, man!He, we gaan geen "zustertje pesten" ...toch ? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
ReaImDown Posted May 25, 2007 Posted May 25, 2007 thnx, man!shift alt D will stop it from running (until its opened again)also, that script only closes the window, it doesnt close MSN 100% it is still in the task bar [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Kip Posted May 25, 2007 Author Posted May 25, 2007 He, we gaan geen "zustertje pesten" ...toch ? nee, maarja. de vorige keer was haar computer na 10 dagen alweer 1 grote troep. dus.. als ze het niet alleen af kan..... MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
ReaImDown Posted May 25, 2007 Posted May 25, 2007 nee, maarja. de vorige keer was haar computer na 10 dagen alweer 1 grote troep. dus.. als ze het niet alleen af kan.....I am confused german? [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Developers Jos Posted May 25, 2007 Developers Posted May 25, 2007 I am confused german?Nope .... look at our "from" .... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Kip Posted May 25, 2007 Author Posted May 25, 2007 shift alt D will stop it from running (until its opened again)also, that script only closes the window, it doesnt close MSN 100% it is still in the task barbut you can replace WinClose() with ProcessClose("msnmsgr.exe")I am confused german?nope, Dutch MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
ReaImDown Posted May 25, 2007 Posted May 25, 2007 but you can replace WinClose() with ProcessClose("msnmsgr.exe")I like your thinking lol [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
jefhal Posted May 25, 2007 Posted May 25, 2007 Why not: If fileexists (mysister's program) then filedelete(mysister's program) endif ...by the way, it's pronounced: "JIF"... Bob Berry --- inventor of the GIF format
ReaImDown Posted May 25, 2007 Posted May 25, 2007 Why not: If fileexists (mysister's program) then filedelete(mysister's program) endif incase its in the common program files, its easier to just close it, [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Moderators SmOke_N Posted May 25, 2007 Moderators Posted May 25, 2007 I don't know about the rest of you... but my main PC is in our office (since I seem to live here now ). I had it password protected, but found it to be a pain for the other networked PC's that needed a file from mine to gain access... so the files I didn't want ran by anyone else, I simply made an AutoIt.exe wrapper for it. 1. Wrote a GUI asking for password. 2. Password Verification. 3. FileInstalled the app to protect within the AutoIt executable I was making. 4. Compiled the AutoIt executable being made with the icon of the app I was wanting to protect, file version, company etc... 5. Named the new wrapper executable the same as the actual, once compiled, just removed the old app. The only issue I could ever see with this, is if the app actually opens itself again, but you can make $cmdline[] options for that as well. It's not as quick as trolling/polling (making the above that is), but I never have to worry about someone shutting it down in a process manager either. Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
GEOSoft Posted May 26, 2007 Posted May 26, 2007 If she's really bad there is always If @UserName == "My Sister" Then Shutdown(12) George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!"
Kip Posted May 26, 2007 Author Posted May 26, 2007 If she's really bad there is alwaysIf @UserName == "My Sister" Then Shutdown(12) MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
Kip Posted May 26, 2007 Author Posted May 26, 2007 but the best is: If ProcessExists("msnmsgr.exe") Then ProcessClose("msnmsgr.exe") MailSpons: Fake SMTP server for safe email testing Dutch postcode & address API.
McGod Posted May 26, 2007 Posted May 26, 2007 (edited) #include <Array.au3> Global $Programs = _ArrayCreate("firefox.exe", "messenger.exe", "bearshare.exe", "notepad.exe");Add programs here Local $list = ProcessList();Grabs all running processes For $i = 1 To $list[0][0] Step 1;Loops them all _KillProcess($list[$i][0]);Sends each to be check and if chosen, closed. Next $list = ProcessList();To get current amount of programs Global $am = $list[0][0];Sets the amount While 1 Sleep(1000);To reduce load $list = ProcessList();Grabs all running processes If $am <> $list[0][0] Then;New Process For $i = 1 To $list[0][0] Step 1;Loops them all _KillProcess($list[$i][0]);Sends each to be check and if chosen, closed. Next $am = $list[0][0];Update amount EndIf WEnd Func _KillProcess($id) For $i = 0 To UBound($Programs)-1 Step 1 If $Programs[$i] = $id Then;If this program is not allowed to run ProcessClose($id);Close program MsgBox(1, "Closed", $id & " is not allowed to be used.");Display message. EndIf Next EndFunc Within the _ArrayCreate() put all your programs u wish to keep from running. Edited May 26, 2007 by Chip [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u]
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