 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Guest
|
Posted: Sun Apr 24, 2005 2:31 am Post subject: Prevent user from running Applications from inside script |
|
|
I am using PGP to encrypt volumns. From a script, I would like to prevent Outlook from being run until the PGP volumn is mounted (It gets really confused and requires a lot of work to fix). I have everything working except the part that locks out Outlook from running.
Do you have any ideas how I can accomplish this in AutoHotKeys?
Thank you in advance |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Sun Apr 24, 2005 10:19 am Post subject: |
|
|
| Quote: | | Do you have any ideas how I can accomplish this in AutoHotKey? | As this sentence finished with a question mark, I guess this topic would have made sense in the Forums ---> Support section, isn't it ???  |
|
| Back to top |
|
 |
CarlosTheTackle
Joined: 19 Oct 2004 Posts: 102
|
Posted: Sun Apr 24, 2005 12:25 pm Post subject: |
|
|
Don't know if this would work (haven't tried it) but maybe you could rename the Outlook.exe file to something like 'Outlook2.exe' and then build another script (compiled to Outlook.exe) that checks to see if your main (mounting) script is running and waits until it is finished before launching Outlook2.exe.
Just make sure mailto links and .eml files don't get re-associated by Windows to Outlook2.exe.
C |
|
| Back to top |
|
 |
Foonman1
Joined: 24 Apr 2005 Posts: 9 Location: San Jose California
|
Posted: Mon Apr 25, 2005 4:24 pm Post subject: Good Idea |
|
|
CarlosTheTackle,
It's a great idea AND it works. Here is the code. Thanks.
I have an even better idea: Hook the spot in Windows XP that any application goes through to run, look for Outlook (or a list of programs), run a script to mount the encrypted drives and pass control back to Windows to run the program.
Any ideas about how to hook Windows for run application requests?
I'm going to post this code and the same question over on the scripts and functions forum.
| Code: | PGPMountedDrive = H
PGPFile = D:\PGPdisk Volume3.pgd
ProgramName = Outlook
RunProgramPath = C:\Program Files\Microsoft Office\OFFICE11\OUTLOOK1.EXE
IfExist, %PGPFile%
goto, cont
else
msgbox, PGP File (%PGPFile%) Missing - You cannot run %ProgramName% - Contact your System Administrator
goto, end
cont:
IfNOTExist, %PGPMountedDrive%:\
RunWait, %PGPFile%
Loop
{
Sleep, 100
IfExist, %PGPMountedDrive%:\
goto, runoutlook
if a_index = 100
goto, novol
Progress, %a_index%, %a_loopfilename%, Waiting for Encrypted Drive to Mount, Mounting...
continue
}
runoutlook:
Progress, Off
;MsgBox, Press Enter to Run Outlook
Run, %RunProgramPath%
goto, end
novol:
Progress, Off
msgbox, Volumn Exists but will not Mount - Contact Administrator
end:
Exit |
|
|
| Back to top |
|
 |
TeknoMusicMan
Joined: 14 Apr 2005 Posts: 188 Location: Wisconsin, USA
|
Posted: Mon Apr 25, 2005 4:30 pm Post subject: |
|
|
I wrote this program to keep my brother from running his games after 10pm. The only problem is that it doesn't prevent them from running, it just closes them right as they start up. Im not sure if this would help you.
| Code: | #NoTrayIcon
#Persistent
#SingleInstance force
pill = 5
play = 1
SetTimer, RegCheck, 1000
SetTimer, TimeCheck, 10000
loop
{
If play = 0
{
Process, Close, Tibia.exe
sleep %pill%
Process, Close, Tibia2.exe
sleep %pill%
Process, Close, Tibia Proxy.exe
sleep %pill%
Process, Close, Skillz 8.5.exe
sleep %pill%
Process, Close, TPR 2.0.exe
sleep %pill%
Process, Close, Steam.exe
sleep %pill%
Process, Close, hl.exe
sleep %pill%
Process, Close, UT2004.exe
sleep %pill%
Process, Close, StartPokerRoom.exe
sleep %pill%
Process, Close, KaiLaunch.exe
sleep %pill%
Process, Close, LimeWire.exe
sleep %pill%
Process, Close, play.exe
sleep %pill%
Process, Close, freecell.exe
sleep %pill%
Process, Close, mshearts.exe
sleep %pill%
Process, Close, bckgzm.exe
sleep %pill%
Process, Close, chkrzm.exe
sleep %pill%
Process, Close, hrtzzm.exe
sleep %pill%
Process, Close, Rvsezm.exe
sleep %pill%
Process, Close, shvlzm.exe
sleep %pill%
Process, Close, winmine.exe
sleep %pill%
Process, Close, PINBALL.EXE
sleep %pill%
Process, Close, sol.exe
sleep %pill%
Process, Close, spider.exe
sleep %pill%
}
sleep %pill%
}
RegCheck:
{
RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, Software\Microsoft\Windows\CurrentVersion\Run, svchost.exe, %A_ScriptFullPath%
Return
}
TimeCheck:
{
If A_Hour >= 22
{
play = 0
}
Else if A_Hour < 06
{
play = 0
}
Else
{
play = 1
}
} |
You could modify the TimeCheck timer to determine weather or not your PGP thingy is mounted _________________
"Make it idiot-proof, and someone will make a better idiot." |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Mon Apr 25, 2005 4:40 pm Post subject: |
|
|
So what will he do once such a game has been terminated ? Surfing the net for "Juicy Lucy" ?
What about to ShutDown the PC ? To disable Keyboard&Mouse ?? To let'm start programming AHK ! |
|
| Back to top |
|
 |
TeknoMusicMan
Joined: 14 Apr 2005 Posts: 188 Location: Wisconsin, USA
|
Posted: Mon Apr 25, 2005 4:45 pm Post subject: |
|
|
This is just one application that My parents had me make for my brother. I also wrote a program that sends commands to the router to block his MAC's at the same time the program on his computer shuts off his games.
He got in big trouble so my parents told me to basically disable all types of "fun" for him without taking away the ability to do homework
so from the times of 10pm to 6am his computer won't load games and he doesn't have access to the internet.  _________________
"Make it idiot-proof, and someone will make a better idiot." |
|
| Back to top |
|
 |
Foonman1
Joined: 24 Apr 2005 Posts: 9 Location: San Jose California
|
Posted: Mon Apr 25, 2005 4:51 pm Post subject: RegCheck code? |
|
|
BoBo, I thought of shutting down the keyboard but then thought that it would be more elegant to intercept programs that tried to use data first. More flexibility. Thanks for the ideas.
TeknoMusicMan,
Thanks for your script. I like the idea of using a timer to test for drive mounted. What does the RegCheck code do?
RegCheck:
{
RegWrite, REG_SZ, HKEY_LOCAL_MACHINE, Software\Microsoft\Windows\CurrentVersion\Run, svchost.exe, %A_ScriptFullPath%
Return
} |
|
| Back to top |
|
 |
TeknoMusicMan
Joined: 14 Apr 2005 Posts: 188 Location: Wisconsin, USA
|
Posted: Mon Apr 25, 2005 5:00 pm Post subject: |
|
|
the RegCheck sub just writes a registry key so that the application i made starts up with windows. I put it on a timer so that if my brother finds the registry entry and deletes it, it will just rewrite it. So far he hasn't found the program running in his task manager either because i named it svchost.exe. Since there are like 6 svchosts running at any 1 point in time he suspects nothing.  _________________
"Make it idiot-proof, and someone will make a better idiot." |
|
| Back to top |
|
 |
Foonman1
Joined: 24 Apr 2005 Posts: 9 Location: San Jose California
|
Posted: Mon Apr 25, 2005 5:11 pm Post subject: |
|
|
TeknoMusicMan,
Very cute. I have to give it some more thought, but, my best bet might be to just make very sure that the drives are mounted at startup(by using a timer and maybe the registry entry). Then I don't have to worry about them (my clients) running programs that use data on those drives. And it would always be watching!
AutoHotKey is a great program and this is a very helpful forum.
Thanks |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|