Break(0) #include $gui = GUICreate("Reg Assistant", 192, 128, -1, -1, $WS_CAPTION + $WS_POPUP + $WS_SYSMENU) $group = GUICtrlCreateGroup("Available Tasks", 8, 8, 177, 81) $ex = GUICtrlCreateRadio("Export the registry", 16, 32, 121, 17) $im = GUICtrlCreateRadio("Import the registry", 16, 56, 121, 17) GuiCtrlSetState($ex, $GUI_CHECKED) GUICtrlCreateGroup("", -99, -99, 1, 1) $go = GUICtrlCreateButton("Process", 8, 96, 137, 25) $what = GUICtrlCreateButton("?", 160, 96, 25, 25) GUISetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $go Go() Case $msg = $what Intro() EndSelect WEnd Exit Func Go() If GuiCtrlRead($ex)= $GUI_CHECKED Then Backup() If GuiCtrlRead($im)= $GUI_CHECKED Then Restore() EndFunc Func Intro() MsgBox(0, "About", "This app is written by Quang Anh." & @CRLF & "Use at your own risk!") EndFunc Func Backup() $to = FileSaveDialog("Destination", "", "Registration File (*.reg)", 16) If Not @Error Then GuiCtrlSetState($go, $GUI_DISABLE) TrayTip("Please wait...", "We're exporting your registry.", 30, 1) If StringInStr($to, ".reg") = 0 Then $to = $to & ".reg" RunWait(@ComSpec & " /c " & 'regedit /e "' & $to & '"', "", @SW_HIDE) TrayTip("", "", 0) MsgBox(64 + 8192, "Information", "Registry exported successfully to " & $to & ".") GuiCtrlSetState($go, $GUI_ENABLE) EndIf EndFunc Func Restore() $from = FileOpenDialog("Source", "", "Registration File (*.reg)", 1 + 2 + 16) If Not @Error Then GuiCtrlSetState($go, $GUI_DISABLE) TrayTip("Please wait...", "We're importing your registry.", 30, 1) RunWait(@ComSpec & " /c " & 'regedit /s "' & $from & '"', "", @SW_HIDE) TrayTip("", "", 0) MsgBox(64 + 8192, "Information", "Registry imported successfully from " & $from & ".") GuiCtrlSetState($go, $GUI_ENABLE) EndIf EndFunc