MrBlack Posted April 30, 2009 Share Posted April 30, 2009 (edited) hi people, i need a script for my job, the target is to restrict access to all programs less the ones i entered in my script, the ideea is to load before explorer. i started from scratch few hours ago and end up with this: CODE#include <GUIConstantsEx.au3> #include <Process.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $Button_1, $Button_2, $Button_3, $Button_4, $Button_5, $Button_6, $Button_7, $font = "Comic Sans MS", $msg GUICreate("fullscreencover",@DesktopWidth,@DesktopHeight,0,0,$WS_POPUP) ; will create a dialog box that when displayed is centered Opt("GUICoordMode", 2) $font = "Times New Roman" GUISetFont(50, 600, $font) ; will display underlined characters $Button_1 = GUICtrlCreateButton("AMANET", centered, 50, 1000, 90) $Button_2 = GUICtrlCreateButton("Solitaire", -1, 5) $Button_3 = GUICtrlCreateButton("Freecell", -1, 5) $Button_4 = GUICtrlCreateButton("Mshearts", -1, 5) $Button_5 = GUICtrlCreateButton("Minesweeper", -1, 5) $Button_6 = GUICtrlCreateButton("Pinball", -1, 5) $Button_7 = GUICtrlCreateButton("Spider Solitaire", -1, 5) GUISetState() ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 Run('C:\Program Files\RevConnect\DCPlusPlus.exe') ; Will Run/Open Notepad Case $msg = $Button_2 Run('sol') ; Will demonstrate Button 2 being pressed Case $msg = $Button_3 Run('freecell') Case $msg = $Button_4 Run('mshearts') Case $msg = $Button_5 Run('winmine') Case $msg = $Button_6 Run('C:\Program Files\Windows NT\Pinball\pinball') Case $msg = $Button_7 Run('spider') EndSelect WEnd EndFunc ;==>Example next step is to insert an admin button wich ask for a password to exit this script and continue load explorer and rest of the programs in windows. ill add later some more buttons like... log off, shut down etc... main problem now is with loading before explorer and dont allow explorer to load untill this script is closed. be as much specific with hints as u can, becouse i only have few hours with autoit. I managed to load before explorer, all programs work well, now i only need help with password stuff, and if is possible, when the correct password is entered: exit script and run explorer.exe sorry for my english thanks in advance Edited May 4, 2009 by MrBlack Link to comment Share on other sites More sharing options...
MrBlack Posted April 30, 2009 Author Share Posted April 30, 2009 (edited) i did something wrong on the way, and now neither the pass thing is working and nor my other buttons. here it is the code: CODE#include <GUIConstantsEx.au3> #include <Process.au3> #include <WindowsConstants.au3> Opt('MustDeclareVars', 1) Example() Func Example() Local $Button_1, $Button_2, $Button_3, $Button_4, $Button_5, $Button_6, $Button_7, $Button_8, $font = "Comic Sans MS", $msg GUICreate("fullscreencover",@DesktopWidth,@DesktopHeight,0,0,$WS_POPUP) ; will create a dialog box that when displayed is centered Opt("GUICoordMode", 2) $font = "Times New Roman" GUISetFont(50, 600, $font) ; will display underlined characters $Button_1 = GUICtrlCreateButton("AMANET", 220, 50, 1000, 90) $Button_2 = GUICtrlCreateButton("Solitaire", -1, 5) $Button_3 = GUICtrlCreateButton("Freecell", -1, 5) $Button_4 = GUICtrlCreateButton("Mshearts", -1, 5) $Button_5 = GUICtrlCreateButton("Minesweeper", -1, 5) $Button_6 = GUICtrlCreateButton("Pinball", -1, 5) $Button_7 = GUICtrlCreateButton("Spider Solitaire", -1, 5) $Button_8 = GuiCtrlCreateButton ("Exit", -1, 5) GUISetState () While 1 Select Case GuiGetMsg() = $Button_8 $PassBox = InputBox ("ExitScript", "Please enter the password to exit the sscript.", "", "*M") If $PassBox = "Password" Then Run('spider') Exit Else MsgBox (48, "Error", "Incorrect password has been entered") EndIf Case Else ;;; EndSelect wend GUISetState() ; will display an dialog box with 2 button ; Run the GUI until the dialog is closed While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button_1 Run('C:\Program Files\RevConnect\DCPlusPlus.exe') ; Will Run/Open Notepad Case $msg = $Button_2 Run('sol') ; Will demonstrate Button 2 being pressed Case $msg = $Button_3 Run('freecell') Case $msg = $Button_4 Run('mshearts') Case $msg = $Button_5 Run('winmine') Case $msg = $Button_6 Run('C:\Program Files\Windows NT\Pinball\pinball') Case $msg = $Button_7 Run('spider') Case $msg = $Button_8 EndSelect WEnd EndFunc ;==>Example any help will be appreciated, im working for last 9 hours on this and im tired Tnx in advance SOLVED by myself (and im very proud) here is my code:CODE#cs ---------------------------------------------------------------------------- AutoIt Version: 3.3.0.0 Author: myName Script Function: Template AutoIt script. #ce ---------------------------------------------------------------------------- ; Script Start - Add your code below here #include <GUIConstantsEx.au3> #include <Process.au3> #include <WindowsConstants.au3> Opt("TrayMenuMode", 1) $font = "Times New Roman" GUISetFont(50, 600, $font) $hGUIMain = GUICreate("fullscreencover", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) $Button = GUICtrlCreateButton("ADMIN", 20, 50, 50, 30) Local $Button_1, $Button_2, $Button_3, $Button_4, $Button_5, $Button_6, $Button_7, $Button_8, $font = "Comic Sans MS", $msg $Button_1 = GUICtrlCreateButton("AMANET", 220, 50, 1000, 90) $Button_2 = GUICtrlCreateButton("Solitaire", 220, 150, 1000, 90) $Button_3 = GUICtrlCreateButton("Freecell", 220, 250, 1000, 90) $Button_4 = GUICtrlCreateButton("Mshearts", 220, 350, 1000, 90) $Button_5 = GUICtrlCreateButton("Minesweeper", 220, 450, 1000, 90) $Button_6 = GUICtrlCreateButton("Pinball", 220, 550, 1000, 90) $Button_7 = GUICtrlCreateButton("Spider Solitaire", 220, 650, 1000, 90) GUISetState () GUISetState() While 1 $boucle_menu = GUIGetMsg() Select Case $boucle_menu = $Button_1 Run('C:\Program Files\RevConnect\DCPlusPlus.exe') Case $boucle_menu = $Button_2 Run('sol') Case $boucle_menu = $Button_3 Run('freecell') Case $boucle_menu = $Button_4 Run('mshearts') Case $boucle_menu = $Button_5 Run('winmine') Case $boucle_menu = $Button_6 Run('C:\Program Files\Windows NT\Pinball\pinball') Case $boucle_menu = $Button_7 Run('spider') Case $boucle_menu = $Button $PassBox = InputBox("ADMIN MODE", "NU UMBLA AICI CA POT SA AFLU, SI-TI IEI PENALIZARI", "", "*M") If $PassBox = "r" Then Run('sol') Sleep(500) Exit Else MsgBox(48, "ADMIN MODE", "AI DEJA 5%") EndIf EndSelect Sleep(20) WEnd Func Example() EndFunc Have a nice day all, i deserve some sleep now well... im not so proud to solve it anymore. from that window wich i builded with autoit i need to start some programs, all starts well, less one, wich is writed in Fox. when i try to run the fox program the script open it, but in the folder where the script is located, and i get error messages becouse the program dont find requeired files. any help will be appreciated tnx in advance Edited May 4, 2009 by MrBlack Link to comment Share on other sites More sharing options...
MrBlack Posted May 4, 2009 Author Share Posted May 4, 2009 sry for the "BUMP" but my question is in edited post Link to comment Share on other sites More sharing options...
Bert Posted May 4, 2009 Share Posted May 4, 2009 You could try to use ShellExecute to start the app instead of Run. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
MrBlack Posted May 4, 2009 Author Share Posted May 4, 2009 (edited) doesent work, same error: "File'd:\kit safe\new tweak\screen\5514150\tipc.dbf'does not exist."with underline is the path to my scriptitalic are some files inside my fox programi dont understand why the script try to execute my program in same folder as the script is...the line from code with problem is: "Case $boucle_menu = $Button_1 ShellExecute("D:\Garant\amanet.exe")"CODE#ce ----------------------------------------------------------------------------; Script Start - Add your code below here#include <Process.au3>#include <WindowsConstants.au3>#include <GUIConstantsEx.au3>#include <GuiButton.au3>#include <GuiImageList.au3>Opt("TrayMenuMode", 1) $hGUIMain = GUICreate("fullscreencover", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)$Button = GUICtrlCreateButton("ADMIN", 20, 50, 50, 30) Local $Button_1, $Button_2, $Button_3, $Button_4, $Button_5, $Button_6, $Button_7, $Button_8, $font = "Times New Roman", $msg $font = "Comic Sans MS" GUISetFont(40, 600, $font) $Button_1 = GUICtrlCreateButton("AMANET", 220, 50, 1000, 90) $Button_2 = GUICtrlCreateButton("Solitaire", 220, 150, 1000, 90) $Button_3 = GUICtrlCreateButton("Freecell", 220, 250, 1000, 90) $Button_4 = GUICtrlCreateButton("Mshearts", 220, 350, 1000, 90) $Button_5 = GUICtrlCreateButton("Minesweeper", 220, 450, 1000, 90) $Button_6 = GUICtrlCreateButton("Pinball", 220, 550, 1000, 90) $Button_7 = GUICtrlCreateButton("Spider Solitaire", 220, 650, 1000, 90) $font = "Comic Sans MS" GUISetFont(15, 600, $font) $Button_8 = GUICtrlCreateButton("SAFE REMOVE USB", 220, 750, 300, 90) $Button_9 = GUICtrlCreateButton("INCHIDE CALCULATOR", 553, 750, 300, 90) GUICtrlCreateLabel(" © Casa de Amanet GARANT Toate drepturile rezervate 2009 ©", 20, 20) GUISetState ()GUISetState()While 1 $boucle_menu = GUIGetMsg() Select Case $boucle_menu = $Button_1 ShellExecute("D:\Garant\amanet.exe") Case $boucle_menu = $Button_2 Run('sol') Case $boucle_menu = $Button_3 Run('freecell') Case $boucle_menu = $Button_4 Run('mshearts') Case $boucle_menu = $Button_5 Run('winmine') Case $boucle_menu = $Button_6 Run('C:\Program Files\Windows NT\Pinball\pinball') Case $boucle_menu = $Button_7 Run('spider') Case $boucle_menu = $Button_8 Run('system32\rundll32.exe shell32.dll,Control_RunDLL hotplug.dll') Case $boucle_menu = $Button_9 Shutdown(9) Case $boucle_menu = $Button $PassBox = InputBox("ADMIN MODE", "NU UMBLA AICI CA POT SA AFLU, SI-TI IEI PENALIZARI", "", "*M") If $PassBox = "r" Then Run('explorer.exe') Sleep(1000) Run('regedit') Sleep(1000) Exit Else MsgBox(48, "ADMIN MODE", "AI DEJA 5%") EndIf EndSelect Sleep(20)WEndFunc Example() EndFuncfull code inserted for better view Edited May 4, 2009 by MrBlack Link to comment Share on other sites More sharing options...
MrBlack Posted May 4, 2009 Author Share Posted May 4, 2009 done, thanx for hint Volly, works nice now, after you told me about ShellExecute i missed second "" to leave parameters blank. when ill be home ill post all the parts of this screen lock. I use it to restrict access in windows for some employes, they will have all windows games and main work program, rest is all locked, the good thing is they dont need internet explorer or any browser, cose no internet connection there. Thanx all for help Have a nice day Link to comment Share on other sites More sharing options...
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