earl82 Posted January 11, 2011 Share Posted January 11, 2011 Hey to anyone that this may help, I was having trouble changing the color of me buttons for my restore partition GUI. I have found that if you use a pic as your button you can make any button you want. PS I am using WinPE as my restore OS. here is a example ;This the GUI automation for restoration process ; Required includes for the GUI interface #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> #include <ProgressConstants.au3> #include <SendMessage.au3> ;This creates the varibles required for the proccess $varRestart = "X:\shutdown.exe -r -t 00" ; Var for Restart a sytem in side a win PE enviroment $varGhostrestore = "X:\ghost\ghost32.exe -clone,mode=prestore,src=1:1\restore.gho:1,dst=1:2 -batch -quiet -rb" ; this is the command that executes the ghost restore ;this installs the picture fields used in the GUI FileInstall("X:\images\recovery.bmp" , "") FileInstall("X:\images\restart.bmp" , "") FileInstall("X:\images\restore.bmp" , "") ;this the main GUI page #Region ### START Koda GUI section ### Form=c:\recovery\recoverygui.kxf $width = 730 $height = 460 $Formmain = GUICreate("System Restore", 700, 400, @DesktopWidth/2 - $width/2, @DesktopHeight/2 - $height/2) GUISetBkColor(0xFFFFFF) ; will change background color $wPos = WinGetPos($Formmain) GUISetFont(12, 400, 0, "MS Sans Serif") $Pic2 = GUICtrlCreatePic("X:\images\restart.bmp", 100, 334, 55, 55, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUICtrlSetColor(-1, 0xFF0000) GUISetFont(12, 400, 0, "MS Sans Serif") $Pic3 = GUICtrlCreatePic("X:\images\restore.bmp", 500, 334, 55, 55, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUICtrlSetColor(-1, 0xFF0000) $Pic1 = GUICtrlCreatePic("X:\images\recovery.bmp", 80, 80, 200, 200, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS)) GUICtrlSetColor(-1, 0xFF0000) GUISetFont(20, 400, 0, "MS Sans Serif") $Label3 = GUICtrlCreateLabel("WARNING!", 390, 50, 400, 50) GUICtrlSetColor(-1, 0xFF0000) GUISetFont(12, 400, 0, "MS Sans Serif") $Label4 = GUICtrlCreateLabel("Restoring the hard drive image", 350, 100, 561, 24) $Label7 = GUICtrlCreateLabel("will erase all data on the drive!", 350, 120, 561, 24) $Label11= GUICtrlCreateLabel("Music, Pitcures, Videos, Documents, etc,", 320, 150, 561, 24) $Label12= GUICtrlCreateLabel("will be permanently lost.", 370, 170, 561, 24) $Label5 = GUICtrlCreateLabel("The operating system will be set to", 330, 200, 566, 24) $Label8 = GUICtrlCreateLabel("default factory settings.", 370, 220, 566, 24) $Label6 = GUICtrlCreateLabel("Click the Green Arrow if you want", 340, 250, 394, 24) $Label10 = GUICtrlCreateLabel("to proceed with system restore.", 350, 270, 394, 24) $Label13 = GUICtrlCreateLabel("If not click Red X to restart system.", 340, 290, 394, 24) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### ;this the main GUI for the Restart Message #Region ### START Koda GUI section ### Form=c:\recovery\recoveryRestore.kxf $width = 330 $height = 160 $FormRestart = GUICreate("Please Wait...", 337, 123, @DesktopWidth/2 - $width/2, @DesktopHeight/2 - $height/2) GUISetBkColor(0xFFFFFF) ; will change background color GUISetFont(13, 400, 0, "MS Sans Serif") $Label9 = GUICtrlCreateLabel("Computer is now restarting.", 16, 8, 308, 24) #EndRegion ### END Koda GUI section ### ;This creates the GUI for the YES/NO Restoreation #Region ### START Koda GUI section ### Form=c:\recovery\recoveryRestore.kxf $width = 330 $height = 160 $FormRestore = GUICreate("Attention!", 337, 123, @DesktopWidth/2 - $width/2, @DesktopHeight/2 - $height/2) GUISetBkColor(0xFFFFFF) ; will change background color $Yes = GUICtrlCreateButton("Yes", 72, 88, 75, 25, 0) $No = GUICtrlCreateButton("No", 208, 88, 75, 25, 0) $Label1 = GUICtrlCreateLabel("with system restore?", 80, 40, 209, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") $Label2 = GUICtrlCreateLabel("Are you sure you want to continue", 18, 8, 308, 24) GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") #EndRegion ### END Koda GUI section ### ;Creates the Loop that runs while main gui is active musted be called any time the main gui is used Func Main() $global_sleep = 10 ; change main loop sleep duration here $blink_sleep = 250 ; change blink sleep duration here $total_blink_sleep = 0 $right = 0 While 1 $nMsg = GUIGetMsg() ;If $nMsg=-3 Then Exit If $nMsg=$Pic2 then Restart1() If $nMsg=$Pic3 then Restore1() If $nMsg=$GUI_EVENT_CLOSE then Restart1() If $nMsg=$Pic3 Or $nMsg=$Pic3 then Exit If $total_blink_sleep >= $blink_sleep Then $total_blink_sleep = 0 ; reset total blink sleep If $right = 0 then $right = 1 GUICtrlSetColor($label3,0xFF0000) ; Red else $right = 0 GUICtrlSetColor($label3,0xDCDCDC) ; BKGround EndIf Else $total_blink_sleep = $total_blink_sleep + $global_sleep EndIf sleep($global_sleep) WEnd EndFunc ; this Function call for the Restart command Func Restart1() GUISetState (@SW_SHOW, $FormRestart) Run(@ComSpec & " /c " & $varRestart, "", @SW_HIDE) EndFunc Func Restore1() GUISetState (@SW_SHOW, $FormRestore) While 1 $nMsg = GUIGetMsg() If $nMsg=-3 Then No1() If $nMsg=$No then No1() If $nMsg=$Yes then Yes1() Switch $nMsg Case $GUI_EVENT_CLOSE Main() EndSwitch WEnd EndFunc Func Yes1() GUISetState(@SW_HIDE, $FormRestore) GUISetState(@SW_HIDE, $Formmain) Run (@ComSpec & " /c " & $varGhostrestore, "", @SW_HIDE) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd EndFunc Func No1() GUISetState (@SW_HIDE, $FormRestore) GUISetState (@SW_SHOW, $Formmain) Main() EndFunc ; this funtion refence the main loop and allows for the main mune to operate Main() Hope this helps anyone that needs it. I know that I did when I started. :-) GOD Bless 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