Duivelke Posted September 17, 2006 Share Posted September 17, 2006 OK, I want to update the statusbar with the values of $a_PartsText, but it won't work. Just for testing, I have put a display Statusbar message if the progressbar reaches 50%. But still, it doesn't change my statusbar text. What am I doing wrong ??? Here is the code: expandcollapse popup#include <GuiConstants.au3> #include <GUIStatusbar.au3> $gui = GuiCreate("SMTP2GO Version 1.1 BETA", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) Local $a_PartsRightEdge[3] = [100, 350, -1] Local $a_PartsText[3] = ["Ready", "Updating SMTP Server", "Done"] $update = "Updating SMTP Server..." $Warning_Message = GuiCtrlCreateLabel("Welcome to SMTP2GO. Please make sure you have configured the outgoing mailserver for your e-mailaccounts in your favourite e-mailclient to MAILSERVER before continuing.", 50, 20, 300, 70) $Warning_Image = GuiCtrlCreatePic("warning.gif", 10, 20, 38, 40) $InputBox = GuiCtrlCreateInput("<put your SMTP Server here !>", 40, 110, 270, 20) $Button_4 = GuiCtrlCreateButton(" > Change ", 320, 110, 60, 20) $Progress_5 = GuiCtrlCreateProgress(20, 150, 360, 20) $StatusBar1 = _GUICtrlStatusBarCreate ($gui, 100, $a_PartsText) GuiSetState() $wait = 20 $s = 0 Do $msg = GUIGetMsg() If $msg = $Button_4 Then GUICtrlSetData($Button_4, " > Stop ") For $i = $s To 100 If GuiCtrlRead($Progress_5) = 50 Then _GuiCtrlStatusBarSetText ($StatusBar1, $a_PartsText, 2) EndIf $m = GuiGetMsg () If $m = -3 Then ExitLoop If $m = $Button_4 Then GuiCtrlSetData($Button_4, " > Next ") $s = $i ExitLoop Else $s = 0 GuiCtrlSetData ($Progress_5, $i) Sleep($wait) EndIf Next If $i > 100 Then $s = 0 GUICtrlSetData ($Button_4, " > Change ") EndIf EndIf until $msg = $GUI_EVENT_CLOSE While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit Thanks in advance Link to comment Share on other sites More sharing options...
GaryFrost Posted September 17, 2006 Share Posted September 17, 2006 expandcollapse popup#include <GuiConstants.au3> #include <GUIStatusbar.au3> $gui = GUICreate("SMTP2GO Version 1.1 BETA", 392, 316, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) Local $a_PartsRightEdge[3] = [100, 350, -1] Local $a_PartsText[3] = ["Ready", "Updating SMTP Server", ""] $update = "Updating SMTP Server..." $Warning_Message = GUICtrlCreateLabel("Welcome to SMTP2GO. Please make sure you have configured the outgoing mailserver for your e-mailaccounts in your favourite e-mailclient to MAILSERVER before continuing.", 50, 20, 300, 70) $Warning_Image = GUICtrlCreatePic("warning.gif", 10, 20, 38, 40) $InputBox = GUICtrlCreateInput("<put your SMTP Server here !>", 40, 110, 270, 20) $Button_4 = GUICtrlCreateButton(" > Change ", 320, 110, 60, 20) $Progress_5 = GUICtrlCreateProgress(20, 150, 360, 20) $StatusBar1 = _GUICtrlStatusBarCreate($gui, $a_PartsRightEdge, $a_PartsText) ; this was incorrect GUISetState() $wait = 20 $s = 0 Do $msg = GUIGetMsg() If $msg = $Button_4 Then GUICtrlSetData($Button_4, " > Stop ") For $i = $s To 100 If GUICtrlRead($Progress_5) = 50 Then _GUICtrlStatusBarSetText($StatusBar1, "Half", 2) ; this was incorrect EndIf $m = GUIGetMsg() If $m = -3 Then ExitLoop If $m = $Button_4 Then GUICtrlSetData($Button_4, " > Next ") $s = $i ExitLoop Else $s = 0 GUICtrlSetData($Progress_5, $i) Sleep($wait) EndIf Next If $i > 100 Then $s = 0 GUICtrlSetData($Button_4, " > Change ") _GUICtrlStatusBarSetText($StatusBar1, "Done", 2) EndIf EndIf Until $msg = $GUI_EVENT_CLOSE SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Duivelke Posted September 17, 2006 Author Share Posted September 17, 2006 OK, I changed the code in what you wrote. But now I have the following ... ready ... | Updating SMTP Server | After the second | I get a Half when it reaches 50% and a done when it is finished. What I want is that it says "Ready ..." at the beginning, when the button is clicked it says "Updating SMTP server" which replaces "Ready ..." and at the end it says "Done !" which is replacing "Updating SMTP Server" Can that be done ? Link to comment Share on other sites More sharing options...
GaryFrost Posted September 17, 2006 Share Posted September 17, 2006 expandcollapse popup#include <GuiConstants.au3> #include <GUIStatusbar.au3> $gui = GUICreate("SMTP2GO Version 1.1 BETA", 392, 316, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) Local $a_PartsRightEdge[1] = [-1] Local $a_PartsText[1] = [@TAB & "Ready"] $update = "Updating SMTP Server..." $Warning_Message = GUICtrlCreateLabel("Welcome to SMTP2GO. Please make sure you have configured the outgoing mailserver for your e-mailaccounts in your favourite e-mailclient to MAILSERVER before continuing.", 50, 20, 300, 70) $Warning_Image = GUICtrlCreatePic("warning.gif", 10, 20, 38, 40) $InputBox = GUICtrlCreateInput("<put your SMTP Server here !>", 40, 110, 270, 20) $Button_4 = GUICtrlCreateButton(" > Change ", 320, 110, 60, 20) $Progress_5 = GUICtrlCreateProgress(20, 150, 360, 20) $StatusBar1 = _GUICtrlStatusBarCreate($gui, $a_PartsRightEdge, $a_PartsText) ; this was incorrect GUISetState() $wait = 20 $s = 0 Do $msg = GUIGetMsg() If $msg = $Button_4 Then _GUICtrlStatusBarSetText($StatusBar1, @TAB & "Updating SMTP Server") GUICtrlSetData($Button_4, " > Stop ") For $i = $s To 100 If GUICtrlRead($Progress_5) = 50 Then _GUICtrlStatusBarSetText($StatusBar1, @TAB & "Half") ; this was incorrect EndIf $m = GUIGetMsg() If $m = -3 Then ExitLoop If $m = $Button_4 Then GUICtrlSetData($Button_4, " > Next ") $s = $i ExitLoop Else $s = 0 GUICtrlSetData($Progress_5, $i) Sleep($wait) EndIf Next If $i > 100 Then $s = 0 GUICtrlSetData($Button_4, " > Change ") _GUICtrlStatusBarSetText($StatusBar1, @TAB & "Done") EndIf EndIf Until $msg = $GUI_EVENT_CLOSE SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Duivelke Posted September 17, 2006 Author Share Posted September 17, 2006 OK, finally got that working. Thanks for that ! Now facing another problem: The EXIT button does not work ... The code: expandcollapse popup#include <GuiConstants.au3> #include <GUIStatusbar.au3> #include <File.au3> #include <Array.au3> #include <XSkin.au3> $Skin_Folder = FileReadLine("C:\Program Files\SMTP2GO\Skins\Default.txt", 1) AutoItSetOption("GUIOnEventMode", 1) $guiWidth = 392 $guiHeight = 216 $guiTitle = "SMTP2GO v2.0" $header = 1 $round_corners = 1 $IBTitle = "Inputbox" $IBText = "<your SMTP Server here ...>" $IBDefault = "" SplashImageOn ("", "C:\Program Files\SMTP2GO\splash.gif", 400, 263, -1, -1, 1) Sleep(5000) SplashOff() $SMTPServer = String("") $TheFileItself = "C:\WINDOWS\SYSTEM32\Drivers\Etc\HOSTS" $gui = XSkinGUICreate($guiTitle, $guiWidth, $guiHeight, $Skin_Folder, $header, $round_corners) ;$gui = GUICreate("SMTP2GO Version 1.1 BETA", 392, 216, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) Local $a_PartsRightEdge[1] = [300] Local $a_PartsText[1] = [" Ready ..."] $Warning_Message = GUICtrlCreateLabel("Welcome to SMTP2GO. Please make sure you have configured the outgoing mailserver for your e-mailaccounts in your favourite e-mailclient to MAILSERVER before continuing.", 60, 40, 300, 70) $Warning_Image = GUICtrlCreatePic("warning.gif", 20, 40, 38, 40) $InputBox = GUICtrlCreateInput("<put your SMTP Server here !>", 30, 110, 270, 20) $Button_4 = GUICtrlCreateButton(" > Change ", 310, 110, 60, 20) $Button_5 = GUICtrlCreateButton(" EXIT ", 310, 130, 60, 20) $Progress_5 = GUICtrlCreateProgress(20, 150, 350, 20) $StatusBar1 = _GUICtrlStatusBarCreate($gui, $a_PartsRightEdge, $a_PartsText) GUISetState() $wait = 20 $s = 0 Do $msg = GUIGetMsg() If $msg = $Button_4 Then GUICtrlSetData($Button_4, " > Stop ") For $i = $s To 100 If GUICtrlRead($Progress_5) = 1 Then _GUICtrlStatusBarSetText($StatusBar1, " Updating SMTP Server. Please hold ...", 0) EndIf $m = GUIGetMsg() If $m = -3 Then ExitLoop If $m = $Button_4 Then GUICtrlSetData($Button_4, " > Next ") $s = $i ExitLoop Else $s = 0 GUICtrlSetData($Progress_5, $i) Sleep($wait) $SMTPServer = GuiCtrlRead($InputBox) TCPStartup() $SMTPIP = TCPNameToIP($SMTPServer) Func _StringInFile($file, $string) Local $avLines[_FileCountLines($file)] _FileReadToArray($file, $avLines) For $i = 1 to $avLines[0] if (StringInStr($avLines[$i], $string)) Then $words = StringSplit($avLines[$i], " ") for $x = 1 to $words[0] if (StringInStr($words[$x], $string)) Then Return $words[$x] Else EndIf Next Else EndIf Next Return False EndFunc $HereItIs = _StringInFile("C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS", "MAILSERVER") $NewSMTP = $SMTPIP & @TAB & "MAILSERVER" $ReplaceIt = _ReplaceStringInFile("C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS", $HereItIs, $NewSMTP) FileClose($TheFileItSelf) ElseIf $msg = $Button_5 Then GUIDelete ($gui) Exit EndIf Next If $i > 100 Then $s = 0 GUICtrlSetData($Button_4, " > Change ") _GUICtrlStatusBarSetText($StatusBar1, " Done !", 0) MsgBox(0, "SMTP2GO Version 1.1 BETA", "Your SMTP Server was successfully changed. You can exit this program !") EndIf EndIf Until $msg = $GUI_EVENT_CLOSE While 1 $msg2 = GuiGetMsg() If $msg2 = $Button_5 Then GuiDelete($gui) Exit EndIf WEnd Exit Link to comment Share on other sites More sharing options...
GaryFrost Posted September 17, 2006 Share Posted September 17, 2006 Until $msg = $GUI_EVENT_CLOSE Or $msg = $Button_5 and take the while loop out not needed after the do loop SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Duivelke Posted September 17, 2006 Author Share Posted September 17, 2006 I tought about that too, but I still cannot exit with the EXIT button ... expandcollapse popup#include <GuiConstants.au3> #include <GUIStatusbar.au3> #include <File.au3> #include <Array.au3> #include <XSkin.au3> $Skin_Folder = FileReadLine("C:\Program Files\SMTP2GO\Skins\Default.txt", 1) AutoItSetOption("GUIOnEventMode", 1) $guiWidth = 392 $guiHeight = 216 $guiTitle = "SMTP2GO v2.0" $header = 1 $round_corners = 1 $IBTitle = "Inputbox" $IBText = "<your SMTP Server here ...>" $IBDefault = "" SplashImageOn ("", "C:\Program Files\SMTP2GO\splash.gif", 400, 263, -1, -1, 1) Sleep(5000) SplashOff() $SMTPServer = String("") $TheFileItself = "C:\WINDOWS\SYSTEM32\Drivers\Etc\HOSTS" $gui = XSkinGUICreate($guiTitle, $guiWidth, $guiHeight, $Skin_Folder, $header, $round_corners) ;$gui = GUICreate("SMTP2GO Version 1.1 BETA", 392, 216, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) Local $a_PartsRightEdge[1] = [300] Local $a_PartsText[1] = [" Ready ..."] $Warning_Message = GUICtrlCreateLabel("Welcome to SMTP2GO. Please make sure you have configured the outgoing mailserver for your e-mailaccounts in your favourite e-mailclient to MAILSERVER before continuing.", 60, 40, 300, 70) $Warning_Image = GUICtrlCreatePic("warning.gif", 20, 40, 38, 40) $InputBox = GUICtrlCreateInput("<put your SMTP Server here !>", 30, 110, 270, 20) $Button_4 = GUICtrlCreateButton(" > Change ", 310, 110, 60, 20) $Button_5 = GUICtrlCreateButton(" EXIT ", 310, 130, 60, 20) $Progress_5 = GUICtrlCreateProgress(20, 150, 350, 20) $StatusBar1 = _GUICtrlStatusBarCreate($gui, $a_PartsRightEdge, $a_PartsText) GUISetState() $wait = 20 $s = 0 Do $msg = GUIGetMsg() If $msg = $Button_4 Then GUICtrlSetData($Button_4, " > Stop ") For $i = $s To 100 If GUICtrlRead($Progress_5) = 1 Then _GUICtrlStatusBarSetText($StatusBar1, " Updating SMTP Server. Please hold ...", 0) EndIf $m = GUIGetMsg() If $m = -3 Then ExitLoop If $m = $Button_4 Then GUICtrlSetData($Button_4, " > Next ") $s = $i ExitLoop Else $s = 0 GUICtrlSetData($Progress_5, $i) Sleep($wait) $SMTPServer = GuiCtrlRead($InputBox) TCPStartup() $SMTPIP = TCPNameToIP($SMTPServer) Func _StringInFile($file, $string) Local $avLines[_FileCountLines($file)] _FileReadToArray($file, $avLines) For $i = 1 to $avLines[0] if (StringInStr($avLines[$i], $string)) Then $words = StringSplit($avLines[$i], " ") for $x = 1 to $words[0] if (StringInStr($words[$x], $string)) Then Return $words[$x] Else EndIf Next Else EndIf Next Return False EndFunc $HereItIs = _StringInFile("C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS", "MAILSERVER") $NewSMTP = $SMTPIP & @TAB & "MAILSERVER" $ReplaceIt = _ReplaceStringInFile("C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS", $HereItIs, $NewSMTP) FileClose($TheFileItSelf) ElseIf $msg = $Button_5 Then GUIDelete ($gui) Exit EndIf Next If $i > 100 Then $s = 0 GUICtrlSetData($Button_4, " > Change ") _GUICtrlStatusBarSetText($StatusBar1, " Done !", 0) MsgBox(0, "SMTP2GO Version 1.1 BETA", "Your SMTP Server was successfully changed. You can exit this program !") EndIf EndIf Until $msg = $GUI_EVENT_CLOSE or $msg = $Button_5 Link to comment Share on other sites More sharing options...
GaryFrost Posted September 17, 2006 Share Posted September 17, 2006 1. Remove AutoItSetOption("GUIOnEventMode", 1) 2. You need to place your _StringInFile ($file, $string) function preferably at the end of the script Might also be easier to read using Select or Switch statements, I started to convert it over to those but your if else statements don't make sense. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
GaryFrost Posted September 17, 2006 Share Posted September 17, 2006 This should get you a little closer, the case else with-in the for loop in the Switch looks like it needs work. expandcollapse popup#include <GuiConstants.au3> #include <GUIStatusbar.au3> #include <File.au3> #include <Array.au3> #include <XSkin.au3> $Skin_Folder = FileReadLine("C:\Program Files\SMTP2GO\Skins\Default.txt", 1) $guiWidth = 392 $guiHeight = 216 $guiTitle = "SMTP2GO v2.0" $header = 1 $round_corners = 1 $IBTitle = "Inputbox" $IBText = "<your SMTP Server here ...>" $IBDefault = "" SplashImageOn ("", "C:\Program Files\SMTP2GO\splash.gif", 400, 263, -1, -1, 1) Sleep(5000) SplashOff() $SMTPServer = String("") $TheFileItself = "C:\WINDOWS\SYSTEM32\Drivers\Etc\HOSTS" $gui = XSkinGUICreate($guiTitle, $guiWidth, $guiHeight, $Skin_Folder, $header, $round_corners) ;~ $gui = GUICreate("SMTP2GO Version 1.1 BETA", 392, 216, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) Local $a_PartsRightEdge[1] = [300] Local $a_PartsText[1] = [" Ready ..."] $Warning_Message = GUICtrlCreateLabel("Welcome to SMTP2GO. Please make sure you have configured the outgoing mailserver for your e-mailaccounts in your favourite e-mailclient to MAILSERVER before continuing.", 60, 40, 300, 70) $Warning_Image = GUICtrlCreatePic("warning.gif", 20, 40, 38, 40) $InputBox = GUICtrlCreateInput("<put your SMTP Server here !>", 30, 110, 270, 20) $Button_4 = GUICtrlCreateButton(" > Change ", 310, 110, 60, 20) $Button_5 = GUICtrlCreateButton(" EXIT ", 310, 130, 60, 20) $Progress_5 = GUICtrlCreateProgress(20, 150, 350, 20) $StatusBar1 = _GUICtrlStatusBarCreate($gui, $a_PartsRightEdge, $a_PartsText) GUISetState() $wait = 20 $s = 0 While 1 $msg = GUIGetMsg() Switch $msg Case $GUI_EVENT_CLOSE, $Button_5 ExitLoop Case $Button_4 GUICtrlSetData($Button_4, " > Stop ") For $i = $s To 100 $m = GUIGetMsg() Switch $m Case $GUI_EVENT_CLOSE ExitLoop Case $Button_4 GUICtrlSetData($Button_4, " > Next ") $s = $i ExitLoop Case Else If GUICtrlRead($Progress_5) = 1 Then _GUICtrlStatusBarSetText($StatusBar1, " Updating SMTP Server. Please hold ...", 0) $s = 0 GUICtrlSetData($Progress_5, $i) Sleep($wait) $SMTPServer = GUICtrlRead($InputBox) TCPStartup() $SMTPIP = TCPNameToIP($SMTPServer) $HereItIs = _StringInFile ("C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS", "MAILSERVER") $NewSMTP = $SMTPIP & @TAB & "MAILSERVER" $ReplaceIt = _ReplaceStringInFile("C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS", $HereItIs, $NewSMTP) FileClose($TheFileItself) EndSwitch Next If $i >= 100 Then $s = 0 GUICtrlSetData($Button_4, " > Change ") _GUICtrlStatusBarSetText($StatusBar1, " Done !", 0) MsgBox(0, "SMTP2GO Version 1.1 BETA", "Your SMTP Server was successfully changed. You can exit this program !") EndIf Case $Button_5 GUIDelete($gui) Exit Case Else EndSwitch WEnd Func _StringInFile($file, $string) Local $avLines[_FileCountLines($file) ] _FileReadToArray($file, $avLines) For $i = 1 To $avLines[0] If (StringInStr($avLines[$i], $string)) Then $words = StringSplit($avLines[$i], " ") For $x = 1 To $words[0] If (StringInStr($words[$x], $string)) Then Return $words[$x] Else EndIf Next Else EndIf Next Return False EndFunc ;==>_StringInFile SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Valuater Posted September 17, 2006 Share Posted September 17, 2006 (edited) @gafrost i didn't know you were working on this. this is the first XSkin.au3 file i have seen so i thought i would help @Both XSkin au3 requires "oneventmode" heres an effort...... You need the latest XSkin.au3 v1.2.0 **** Partially Tested , not the actual changes of "MAILSERVER" expandcollapse popup#include <GuiConstants.au3> #include <GUIStatusbar.au3> #include <File.au3> #include <Array.au3> #include <XSkin.au3> SplashImageOn("", "C:\Program Files\SMTP2GO\splash.gif", 400, 263, -1, -1, 1) AutoItSetOption("GUIOnEventMode", 1) Dim $a_PartsRightEdge[1] =[300] Dim $a_PartsText[1] =[" Ready ..."] Dim $SMTPServer = String("") Dim $TheFileItself = "C:\WINDOWS\SYSTEM32\Drivers\Etc\HOSTS" ; no extenion .txt or ???? Dim $wait = 700, $stopper = 1 ;$Skin_Folder = FileReadLine(@ScriptDir & "\Skins\Default.txt", 1) $Skin_Folder = FileReadLine("C:\Program Files\SMTP2GO\Skins\Default.txt", 1) $guiWidth = 392 $guiHeight = 216 $guiTitle = "SMTP2GO v2.0" ;$guiHeader = 1 ;$guiCorners = 1 $IBTitle = "Inputbox" $IBText = "<your SMTP Server here ...>" $IBDefault = "" $mygui = XSkinGUICreate ($guiTitle, $guiWidth, $guiHeight, $Skin_Folder) ;, $guiHeader, $guiCorners) ;$mygui = GUICreate("SMTP2GO Version 1.1 BETA", 392, 216, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Warning_Message = GUICtrlCreateLabel("Welcome to SMTP2GO. Please make sure you have configured the outgoing mailserver for your e-mailaccounts in your favourite e-mailclient to MAILSERVER before continuing.", 50, 55, 300, 55) $Warning_Image = GUICtrlCreatePic("warning.gif", 20, 40, 38, 40) $InputBox = GUICtrlCreateInput("<put your SMTP Server here !>", 30, 110, 270, 20) $Button_4 = GUICtrlCreateButton(" > Change ", 310, 110, 60, 20) GUICtrlSetOnEvent( -1, "CheckButton") $Button_5 = GUICtrlCreateButton(" EXIT ", 310, 130, 60, 20) GUICtrlSetOnEvent( -1, "Exiter") $Progress_5 = XSkinProgress(20, 155, 350, 20) $StatusBar1 = _GuiCtrlStatusBarCreate($mygui, $a_PartsRightEdge, $a_PartsText) Sleep($wait * 4) SplashOff() Sleep($wait) GUISetState() While 1 Sleep(10) Mouseover() ; required If $stopper <> 1 Then Sleep($wait) GUICtrlSetData($Progress_5, 30) If $stopper Then Reset() ContinueLoop EndIf $SMTPServer = GUICtrlRead($InputBox) If $SMTPServer = "" Or $SMTPServer = "<put your SMTP Server here !>" Then XSkinMsgBox("Server Error #1", "Please type in a correct SMTP Server ") Reset() ContinueLoop EndIf Sleep($wait) GUICtrlSetData($Progress_5, 45) If $stopper Then Reset() ContinueLoop EndIf $TCPStart = TCPStartup() If $TCPStart <> 1 Then XSkinMsgBox("Server Error #2", "The TCP could not be started ") Reset() ContinueLoop EndIf Sleep($wait) GUICtrlSetData($Progress_5, 60) If $stopper Then Reset() ContinueLoop EndIf $SMTPIP = TCPNameToIP($SMTPServer) If $TCPStart = "" Then XSkinMsgBox("Server Error #3", "The TCP IP could not be retrieved ") Reset() ContinueLoop EndIf Sleep($wait) GUICtrlSetData($Progress_5, 75) If $stopper Then Reset() ContinueLoop EndIf $HereItIs = _StringInFile("C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS", "MAILSERVER") If $HereItIs = False Then XSkinMsgBox("Server Error #4", "The MAILSERVER could not be retrieved ") Reset() ContinueLoop EndIf Sleep($wait) GUICtrlSetData($Progress_5, 90) If $stopper Then Reset() ContinueLoop EndIf $NewSMTP = $SMTPIP & @TAB & "MAILSERVER" $ReplaceIt = _ReplaceStringInFile("C:\WINDOWS\SYSTEM32\DRIVERS\ETC\HOSTS", $HereItIs, $NewSMTP) If $ReplaceIt = -1 Then XSkinMsgBox("Server Error #5", "The MAILSERVER could not be replaced ") Reset() ContinueLoop EndIf ;FileClose($TheFileItself) ; not sure this is needed Sleep($wait) GUICtrlSetData($Progress_5, 100) If $stopper Then Reset() ContinueLoop EndIf _GuiCtrlStatusBarSetText($StatusBar1, " Done !", 0) XSkinMsgBox( "SMTP2GO Version 1.1 BETA ", "Your SMTP Server was successfully changed. You can exit this program ! ") Sleep($wait) Reset() EndIf WEnd Func CheckButton() $BInfo = GUICtrlRead($Button_4) If $BInfo = " > Change " Then GUICtrlSetData($Button_4, " > Stop ") _GuiCtrlStatusBarSetText($StatusBar1, " Updating SMTP Server. Please hold ...", 0) Sleep($wait) GUICtrlSetData($Progress_5, 15) $stopper = 0 Else GUICtrlSetData($Button_4, " > Stop ") $stopper = 1 GUICtrlSetData($Progress_5, 0) EndIf EndFunc ;==>CkeckButton Func Reset() GUICtrlSetData($Button_4, " > Change ") _GuiCtrlStatusBarSetText($StatusBar1, $a_PartsRightEdge, $a_PartsText) GUICtrlSetData($Progress_5, 0) $stopper = 1 EndFunc Func Exiter() GUIDelete($mygui) Exit EndFunc ;==>Exiter Func _StringInFile($file, $string) Local $avLines[_FileCountLines($file)] _FileReadToArray($file, $avLines) For $i = 1 To $avLines[0] if (StringInStr($avLines[$i], $string)) Then $words = StringSplit($avLines[$i], " ") For $x = 1 To $words[0] if (StringInStr($words[$x], $string)) Then Return $words[$x] Else EndIf Next Else EndIf Next Return False EndFunc ;==>_StringInFile the new version of XSkin.au3 will be posted in a few minutes 8) Edited September 17, 2006 by Valuater Link to comment Share on other sites More sharing options...
GaryFrost Posted September 17, 2006 Share Posted September 17, 2006 @gafrosti didn't know you were working on this. this is the first XSkin.au3 file i have seen so i thought i would help@BothXSkin au3 requires "oneventmode"I hadn't tested it with the skin, just commented out that stuff and uncommented out the old for helping out. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
Valuater Posted September 17, 2006 Share Posted September 17, 2006 I hadn't tested it with the skin, just commented out that stuff and uncommented out the old for helping out.it was a mess huh...lol8) Link to comment Share on other sites More sharing options...
GaryFrost Posted September 17, 2006 Share Posted September 17, 2006 it was a mess huh...lol8)yep, took 2 seperate attempts to work on that one. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. 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