Jaccus Posted May 30, 2006 Share Posted May 30, 2006 I can't handle two problems I'm having with my script.1.) Firstly while working in OnEventMode (to make buttons working) I can't close my GUI using corner button (I have to click on self-made EXIT button).2.)While GUI is opened my PC is running very slow (at least much slower than without GUI).--------------------------------------Any help will be appreciated.ThanksHere's my code if it helps.expandcollapse popup#include <GuiConstants.au3> ;----------------------------------------------------------------------- $TitleSC = "SocksCap Control" $AdresSC = "D:\Progsy\SocksCapV2\sc32.exe" $DirSC = "D:\Progsy\SocksCapV2\" $Username = "***" $Password = "***" $ResizeHeight = 500 $ResizeWidth = 500 $Proxy1Link = $DirSC & "proxy1.txt" $Proxy2Link = $DirSC & "proxy2.txt" $Proxy3Link = $DirSC & "proxy3.txt" $Proxy4Link = $DirSC & "proxy4.txt" $ErrorTitle = "Error" $ErrorExist = "SocksCap window cannot be found." $ProcessSC = "sc32.exe" ;----------------------------------------------------------------------- GuiCreate("SC Proxy Switcher 1.0 (c) 2006 by Jaccus", 160, 180) GuiSetIcon(@SystemDir & "\mspaint.exe", 0) ;----------------------------------------------------------------------- Opt("GUICoordMode",1) Opt("GUIOnEventMode",1) $RunSCButton = GUICtrlCreateButton("RunSC",1,1,60,20) $ResizeSCButton = GUICtrlCreateButton("ResizeSC",1,25,60,20) $ShowSCButton = GUICtrlCreateButton("ShowSC",1,50,60,20) $CloseSCButton = GUICtrlCreateButton("CloseSC",1,75,60,20) $Import1Button = GUICtrlCreateButton("ImportProxy1",65,1,90,20) $Import2Button = GUICtrlCreateButton("ImportProxy2",65,25,90,20) $Import3Button = GUICtrlCreateButton("ImportProxy3",65,50,90,20) $Import4Button = GUICtrlCreateButton("ImportProxy4",65,75,90,20) $ExitButton = GUICtrlCreateButton("EXIT",1,150,60,20) ;----------------------------------------------------------------------- GUICtrlSetOnEvent($RunSCButton,"RunSC") GUICtrlSetOnEvent($ResizeSCButton,"ResizeSC") GUICtrlSetOnEvent($ShowSCButton,"ShowSC") GUICtrlSetOnEvent($Import1Button,"Import1") GUICtrlSetOnEvent($Import2Button,"Import2") GUICtrlSetOnEvent($Import3Button,"Import3") GUICtrlSetOnEvent($Import4Button,"Import4") GUICtrlSetOnEvent($ExitButton,"GuiExit") GUICtrlSetOnEvent($CloseSCButton,"CloseSC") ;----------------------------------------------------------------------- GuiSetState() While 1 $msg = GuiGetMsg() If $msg = $GUI_EVENT_CLOSE Then ExitLoop WEnd ;----------------------------------------------------------------------- ;----------------------------------------------------------------------- Func RunSC() Run($AdresSC,$DirSC) MinimizeSC() If WinExists($TitleSC) Then MinimizeSC() Else WaitForSC() MinimizeSC() EndIf EndFunc Func ResizeSC() If WinExists($TitleSC) Then WinActivate($TitleSC) WinMove($TitleSC,"",0,0,$ResizeWidth,$ResizeHeight) WinSetState($TitleSC,"",@SW_MINIMIZE) Else MsgBox(0,$ErrorTitle,$ErrorExist) EndIf EndFunc Func ShowSC() If WinExists($TitleSC) Then WinActivate($TitleSC) Else MsgBox(0,$ErrorTitle,$ErrorExist) EndIf EndFunc Func WaitForSC() Sleep(200) MouseClick("left",@DesktopWidth/2,@DesktopHeight/2,1) Sleep(100) MouseClick("right",@DesktopWidth/2,@DesktopHeight/2,1) WinWait("SocksCap Username/Password Authentication") Send($Username) Send("{TAB}") Send($Password) Send("{ENTER}") EndFunc Func GuiExit() Exit EndFunc Func MinimizeSC() WinSetState($TitleSC,"",@SW_MINIMIZE) EndFunc Func CloseSC() If ProcessExists($ProcessSC) Then ProcessClose($ProcessSC) Else MsgBox(0,$ErrorTitle,$ErrorExist) EndIf EndFunc Func Import($SettingsLink) If WinExists($TitleSC) Then WinActivate($TitleSC) Send("{ALT}"&"f"&"i"&"{ENTER}"&$SettingsLink&"{ENTER}"&"{ENTER}"&"{ENTER}") MinimizeSC() Else MsgBox(0,$ErrorTitle,$ErrorExist) EndIf EndFunc Func Import1() Import($Proxy1Link) EndFunc Func Import2() Import($Proxy2Link) EndFunc Func Import3() Import($Proxy3Link) EndFunc Func Import4() Import($Proxy4Link) EndFunc Link to comment Share on other sites More sharing options...
MHz Posted May 30, 2006 Share Posted May 30, 2006 I am sure the helpfile tells you not to use GuiGetMsg() (messageloop mode) with OnEventMode. You are use 2 Modes in the same script. Choose only one or the other. Link to comment Share on other sites More sharing options...
Jaccus Posted May 30, 2006 Author Share Posted May 30, 2006 I am sure the helpfile tells you not to use GuiGetMsg() (messageloop mode) with OnEventMode. You are use 2 Modes in the same script. Choose only one or the other.Emm, so how can I keep GUI visible in OnEventMode without GuiGetMsg() ?I went ~ through helpfile and I thought GuiGetMsg() is required? Link to comment Share on other sites More sharing options...
Valuater Posted May 30, 2006 Share Posted May 30, 2006 Emm, so how can I keep GUI visible in OnEventMode without GuiGetMsg() ? I went ~ through helpfile and I thought GuiGetMsg() is required? code] GuiSetState() While 1 Sleep(10) WEnd 8) Link to comment Share on other sites More sharing options...
mr.underperson Posted May 31, 2006 Share Posted May 31, 2006 And for your close box, try... GUISetOnEvent($GUI_EVENT_CLOSE, "GuiExit") -mu 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