au3scr Posted February 22, 2008 Share Posted February 22, 2008 (edited) Hello, I have problem: When i run my script 1 st time then it closes Process called explorer.exe but when this script is REcalled by an other script then it dont kill explorer.exe Process . I made this script restart it self when it's killed, but it must stay closed if it is closed by function.Now i am closing script by close function but this script still open up again. Questions: How to fix it? How i make that script work that way when i close it by close function then it stay closed , but if that script killed at task manager then it gets restarted? How i can remove input box after i typed password right and clicked ok? Another problem is that when i type right password and click ok, then it closes main window but it opens input window again, this need to be fixed. Information: 1 st script must be compiled and file name must be flux.exe and 2nd script must be compiled and file name must be sticky.exe When you click on exit at flux.exe then 1 st closed sticky.exe (That file restarts flux.exe if it is killed at task manager ) Then explorer is opened and then script closes itself (flux.exe closed).This is a combination of 2 programs 1 st is main programm and 2 nd is guard that restart 1 program (flux) if its killed,but if Flux closed by close func then both scripts must stay closed. ========================================================================================= Default setting (without settings file) Password is blank , just click on ok Cant run any programs listed in menu log off,restart,shutdown functions works ========================================================================================= I hope you can understand me. Here is 1 st script [ (flux) -- need to get fixed ]The main program that must be keep open by sticky.exe . expandcollapse popupOpt("OnExitFunc", "endscript") #include <GUIConstants.au3> #Include <WinAPI.au3> global $pass = FileReadLine(@ScriptDir & "\settings",1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("FluxBox", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) GUISetBkColor(0x3A6EA5) $MenuItem0 = GUICtrlCreateMenu("Programs") $MenuItem01 = GUICtrlCreateMenuItem("Firefox", $MenuItem0) $MenuItem02 = GUICtrlCreateMenuItem("Notepad", $MenuItem0) $MenuItem03 = GUICtrlCreateMenuItem("7-Zip", $MenuItem0) $MenuItem02 = GUICtrlCreateMenuItem("", $MenuItem0) $MenuItem112 = GUICtrlCreateMenu("Office",$MenuItem0) $MenuItem11211 = GUICtrlCreateMenuItem("Open Office Writer", $MenuItem112) $MenuItem11212 = GUICtrlCreateMenuItem("Open Office Math", $MenuItem112) $MenuItem11213 = GUICtrlCreateMenuItem("Open Office Impress", $MenuItem112) $MenuItem11214 = GUICtrlCreateMenuItem("Open Office Draw", $MenuItem112) $MenuItem11215 = GUICtrlCreateMenuItem("Open Office Calc", $MenuItem112) $MenuItem11216 = GUICtrlCreateMenuItem("Open Office Base", $MenuItem112) $MenuItem11217 = GUICtrlCreateMenuItem("Notepad 2", $MenuItem112) $MenuItem11218 = GUICtrlCreateMenuItem("Word", $MenuItem112) $MenuItem11219 = GUICtrlCreateMenuItem("Excel", $MenuItem112) $MenuItem1 = GUICtrlCreateMenu("Exit") $MenuItem11 = GUICtrlCreateMenuItem("exit", $MenuItem1) $MenuItem12 = GUICtrlCreateMenuItem("Shutdown", $MenuItem1) $MenuItem13 = GUICtrlCreateMenuItem("Restart", $MenuItem1) $MenuItem14 = GUICtrlCreateMenuItem("Log Off", $MenuItem1) GUICtrlCreateLabel("<Filename cannot be showen> Loaded with following stting:",10,@DesktopHeight - 100, 350,15) $l1 = GUICtrlCreateLabel("Always On Top: OFF",10,@DesktopHeight - 85, 150,15) $l2 = GUICtrlCreateLabel("Disable Task Mannager: OFF",10,@DesktopHeight - 70, 200,15) $l3 = GUICtrlCreateLabel("Kill Explorer.exe: OFF",10,@DesktopHeight - 55, 150,15) GUICtrlCreateLabel("Require password on close: ON (Cannot be changed)",10,@DesktopHeight -40, 150,15) top () noexp () nodm () GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $MenuItem11 endscript () case $MenuItem01 $load = FileReadLine(@ScriptDir & "\settings",5) Run ($load) case $MenuItem02 $load = FileReadLine(@ScriptDir & "\settings",6) Run ($load) case $MenuItem03 $load = FileReadLine(@ScriptDir & "\settings",7) Run ($load) case $MenuItem11211 $load = FileReadLine(@ScriptDir & "\settings",8) Run ($load) case $MenuItem11212 $load = FileReadLine(@ScriptDir & "\settings",9) Run ($load) case $MenuItem11213 $load = FileReadLine(@ScriptDir & "\settings",10) Run ($load) case $MenuItem11214 $load = FileReadLine(@ScriptDir & "\settings",11) Run ($load) case $MenuItem11215 $load = FileReadLine(@ScriptDir & "\settings",12) Run ($load) case $MenuItem11216 $load = FileReadLine(@ScriptDir & "\settings",13) Run ($load) case $MenuItem11217 $load = FileReadLine(@ScriptDir & "\settings",14) Run ($load) case $MenuItem11218 $load = FileReadLine(@ScriptDir & "\settings",15) Run ($load) case $MenuItem11219 $load = FileReadLine(@ScriptDir & "\settings",15) Run ($load) case $MenuItem12 Shutdown (1) case $MenuItem13 Shutdown (2) case $MenuItem14 Shutdown (0) EndSwitch WEnd Func endscript () $Password = InputBox("Enter Password", "You must enter password to close this window", "", "*") If $Password = $pass Then ProcessClose("sticky.exe") run("explorer") Exit Else EndIf EndFunc func top () $top = FileReadLine (@ScriptDir & "\settings",2) If $top = "Yes" Then GUICtrlSetData ($l1,"Always On Top: ON") WinSetOnTop("FluxBox","",1) If $top = "NO" Then GUICtrlSetData ($l1,"Always On Top: OFF") ;~ ElseIf ;~ GUICtrlSetData ($l1,"Always On Top: OFF") EndIf EndIf EndFunc func noexp () $noexp = FileReadLine (@ScriptDir & "\settings",3) If $noexp = "Yes" Then GUICtrlSetData ($l3,"Kill Explorer.exe: ON") ;~ Run( @ComSpec & "taskkill /f /im explorer.exe") $pid = ProcessExists( "explorer.exe" ) $handle = _WinAPI_OpenProcess(0x1,0,$pid) DllCall("kernel32.dll","int","TerminateProcess","int",$handle,"int",1) run(@scriptdir & "\sticky.exe", @WindowsDir , 1) ;~ run(@scriptdir & "\explorer.exe") ;~ WEnd If $noexp = "No" Then GUICtrlSetData ($l3,"Kill Explorer.exe: OFF") ;~ ElseIf ;~ GUICtrlSetData ($l3,"Kill Explorer.exe: OFF") EndIf EndIf EndFunc func nodm () $noexp = FileReadLine (@ScriptDir & "\settings",4) If $noexp = "Yes" Then GUICtrlSetData ($l2,"Disable Task Mannager: ON") HotKeySet ("^+{Esc}","n") If $noexp = "no" Then GUICtrlSetData ($l2,"Disable Task Mannager: OFF") ;~ ElseIf ;~ GUICtrlSetData ($l2,"Disable Task Mannager: OFF") EndIf EndIf EndFunc func n () sleep(100) msgbox(1,"t","p") EndFuncƒoÝŠ÷ Ú«z+6Û®*m¶rœ’ÈŸ~[±ŠÉ"–Wjwb~+b²Ø^ž·¬µªíŠÒÊ‹œ–'${j×å»az{aŠË®*m…êÞšë-mé"–Wjwm…éæj)ðŠwhÃ¥•·œ–‹uŠ.綬±Êâ¦×èùnÅ«¢+Ø¥¹±Õ‘”€™±ÐíU% ½¹ÍÑ…¹Ñ̹…ÔÌ™Ðì()U% É•…Ñ” ™ÅÕ½ÐíAɽɅ´5…¹…•È™ÅÕ½Ðì°ÄäÀ°ÈÀ°àÀ°ÄÀÀ¤€€ìÝ¥±°É•…Ñ”„‘¥…±½œ‰½àÑ¡…ÐÝ¡•¸‘¥ÍÁ±…啥̕¹Ñ•É•)U%M•ÑMÑ…Ñ”€¡M]}M!=¤)½½Ñ„€ ¤()]¡¥±”€Ä(€€€€˜ŒÀÌØíµÍœ€ôU%•Ñ5Íœ ¤(€€€€(€€€%˜€˜ŒÀÌØíµÍœ€ô€˜ŒÀÌØíU%}Y9Q} 1=MQ¡•¸á¥Ñ1½½À)]•¹()™Õ¹Œ½½Ñ„€ ¤(%Aɽ•ÍÍ]…¥Ñ ±½Í” ™ÅÕ½Ðí™±Õ๕ᔙÅÕ½Ðì¤(%IÕ¸€¡ÍÉ¥ÁÑ‘¥È€™…µÀ쀙ÅÕ½Ð옌ÀäÈí™±Õ๕ᔙÅÕ½Ðì¤)¹‘Õ¹ Compile both of them and then look how they work. If in this text here is anything that you dont understand then ask Thank you for everything . Edited February 22, 2008 by au3scr Link to comment Share on other sites More sharing options...
au3scr Posted February 23, 2008 Author Share Posted February 23, 2008 Can someone help me fixing these problems?I i dont know where are my bugs. Link to comment Share on other sites More sharing options...
newbiescripter Posted February 23, 2008 Share Posted February 23, 2008 try to #include <WindowsConstants.au3> then it works for me. Link to comment Share on other sites More sharing options...
au3scr Posted February 23, 2008 Author Share Posted February 23, 2008 (edited) i what script i need to write it? #include <WindowsConstants.au3> Edit: I tried with flux , it didnt help :S Edited February 23, 2008 by au3scr Link to comment Share on other sites More sharing options...
au3scr Posted February 23, 2008 Author Share Posted February 23, 2008 Hi again I modified my script, now i get error when i kill flux.exe at task manager >>>> Window <<<< Title: Error Class: #32770 Text: _WinAPI_OpenProcess:Standard: The parameter is incorrect. And it dont restart itself. Whats wrong here? Here is new source of flux expandcollapse popupOpt("OnExitFunc", "endscript") #include <GUIConstants.au3> #Include <WinAPI.au3> #include <WindowsConstants.au3> global $pass = FileReadLine(@ScriptDir & "\settings",1) #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("FluxBox", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP) GUISetBkColor(0x3A6EA5) $MenuItem0 = GUICtrlCreateMenu("Programs") $MenuItem01 = GUICtrlCreateMenuItem("Firefox", $MenuItem0) $MenuItem02 = GUICtrlCreateMenuItem("Notepad", $MenuItem0) $MenuItem03 = GUICtrlCreateMenuItem("7-Zip", $MenuItem0) $MenuItem02 = GUICtrlCreateMenuItem("", $MenuItem0) $MenuItem112 = GUICtrlCreateMenu("Office",$MenuItem0) $MenuItem11211 = GUICtrlCreateMenuItem("Open Office Writer", $MenuItem112) $MenuItem11212 = GUICtrlCreateMenuItem("Open Office Math", $MenuItem112) $MenuItem11213 = GUICtrlCreateMenuItem("Open Office Impress", $MenuItem112) $MenuItem11214 = GUICtrlCreateMenuItem("Open Office Draw", $MenuItem112) $MenuItem11215 = GUICtrlCreateMenuItem("Open Office Calc", $MenuItem112) $MenuItem11216 = GUICtrlCreateMenuItem("Open Office Base", $MenuItem112) $MenuItem11217 = GUICtrlCreateMenuItem("Notepad 2", $MenuItem112) $MenuItem11218 = GUICtrlCreateMenuItem("Word", $MenuItem112) $MenuItem11219 = GUICtrlCreateMenuItem("Excel", $MenuItem112) $MenuItem1 = GUICtrlCreateMenu("Exit") $MenuItem11 = GUICtrlCreateMenuItem("exit", $MenuItem1) $MenuItem12 = GUICtrlCreateMenuItem("Shutdown", $MenuItem1) $MenuItem13 = GUICtrlCreateMenuItem("Restart", $MenuItem1) $MenuItem14 = GUICtrlCreateMenuItem("Log Off", $MenuItem1) GUICtrlCreateLabel("<Filename cannot be showen> Loaded with following stting:",10,@DesktopHeight - 100, 350,15) $l1 = GUICtrlCreateLabel("Always On Top: OFF",10,@DesktopHeight - 85, 150,15) $l2 = GUICtrlCreateLabel("Disable Task Mannager: OFF",10,@DesktopHeight - 70, 200,15) $l3 = GUICtrlCreateLabel("Kill Explorer.exe: OFF",10,@DesktopHeight - 55, 150,15) GUICtrlCreateLabel("Require password on close: ON (Cannot be changed)",10,@DesktopHeight -40, 150,15) top () noexp () nodm () GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit case $MenuItem11 endscript () case $MenuItem01 $load = FileReadLine(@ScriptDir & "\settings",5) Run ($load) case $MenuItem02 $load = FileReadLine(@ScriptDir & "\settings",6) Run ($load) case $MenuItem03 $load = FileReadLine(@ScriptDir & "\settings",7) Run ($load) case $MenuItem11211 $load = FileReadLine(@ScriptDir & "\settings",8) Run ($load) case $MenuItem11212 $load = FileReadLine(@ScriptDir & "\settings",9) Run ($load) case $MenuItem11213 $load = FileReadLine(@ScriptDir & "\settings",10) Run ($load) case $MenuItem11214 $load = FileReadLine(@ScriptDir & "\settings",11) Run ($load) case $MenuItem11215 $load = FileReadLine(@ScriptDir & "\settings",12) Run ($load) case $MenuItem11216 $load = FileReadLine(@ScriptDir & "\settings",13) Run ($load) case $MenuItem11217 $load = FileReadLine(@ScriptDir & "\settings",14) Run ($load) case $MenuItem11218 $load = FileReadLine(@ScriptDir & "\settings",15) Run ($load) case $MenuItem11219 $load = FileReadLine(@ScriptDir & "\settings",15) Run ($load) case $MenuItem12 Shutdown (1) case $MenuItem13 Shutdown (2) case $MenuItem14 Shutdown (0) EndSwitch WEnd Func endscript () $Password = InputBox("Enter Password", "You must enter password to close this window", "", "*") If $Password = $pass Then ProcessClose("sticky.exe") run("explorer") ProcessClose("flux.exe") Else EndIf EndFunc func top () $top = FileReadLine (@ScriptDir & "\settings",2) If $top = "Yes" Then GUICtrlSetData ($l1,"Always On Top: ON") WinSetOnTop("FluxBox","",1) If $top = "NO" Then GUICtrlSetData ($l1,"Always On Top: OFF") ;~ ElseIf ;~ GUICtrlSetData ($l1,"Always On Top: OFF") EndIf EndIf EndFunc func noexp () $noexp = FileReadLine (@ScriptDir & "\settings",3) If $noexp = "Yes" Then $pid = ProcessExists( "explorer.exe" ) $handle = _WinAPI_OpenProcess(0x1,0,$pid) DllCall("kernel32.dll","int","TerminateProcess","int",$handle,"int",1) run(@scriptdir & "\sticky.exe", @WindowsDir , 1) If $noexp = "No" Then GUICtrlSetData ($l3,"Kill Explorer.exe: OFF") EndIf EndIf EndFunc func nodm () $noexp = FileReadLine (@ScriptDir & "\settings",4) If $noexp = "Yes" Then GUICtrlSetData ($l2,"Disable Task Mannager: ON") HotKeySet ("^+{Esc}","n") If $noexp = "no" Then GUICtrlSetData ($l2,"Disable Task Mannager: OFF") ;~ ElseIf ;~ GUICtrlSetData ($l2,"Disable Task Mannager: OFF") EndIf EndIf EndFunc func n () sleep(100) msgbox(1,"t","p") EndFunc And here is sticky #include <GUIConstants.au3> #include <WindowsConstants.au3> GUICreate("Program Manager",190,20,80,100) ; will create a dialog box that when displayed is centered GUISetState (@SW_SHOW) oota () While 1 $msg = GUIGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop Wend func oota () ProcessWaitClose("flux.exe") Run (@scriptdir & "\flux.exe") Exit EndFunc 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