;create child window with Updates additional settings Func GUIUpdate() ;if other child already exists If WinExists($GUI_child) Then GUICtrlSetStyle($grf_connectors[1], $ACS_TRANSPARENT) GUICtrlSetStyle($grf_connectors[3], $ACS_TRANSPARENT) GUIDelete($GUI_child) If GUICtrlGetState($btn_1win_set) = 144 Then GUICtrlSetState($btn_1win_set, $GUI_ENABLE) If GUICtrlGetState($btn_3programs) = 144 Then GUICtrlSetState($btn_3programs, $GUI_ENABLE) $p_R_winset = False $p_R_programs = False EndIf Local $ctrl_width = ($section2_width - 2 * $spacer) / 2 Local $ctrl_height = 20 Local $group_height = 3 * $spacer + 8 * $ctrl_height Local $group_width = $section2_width If $group_height > $gui_height - (2 * $spacer) + 4 Then $group_width -= 20 Local $ctrl_width_full = $group_width - 2 * $spacer Local $pos_y ;disable control to avoid problems GUICtrlSetState($btn_2update, $GUI_DISABLE) ;enable line from control to child GUICtrlSetStyle($grf_connectors[2], $SS_BLACKRECT) ;create child GUI $GUI_child = GUICreate("", $section2_width, $gui_height - (2 * $spacer + $header_height), $section1_width _ + 3 * $spacer, $header_height + 4, $WS_CHILD, -1, $Odin_GUI) _GUIScrollbars_Generate($GUI_child, 0, $group_height) GUICtrlCreateGroup("Additional settings for Updates", 0, 0, $group_width, $group_height) GUICtrlSetFont(-1, 8.5, 0, 4) #Region Choose updates $pos_y = 2 * $spacer $prog_Update[3][2] = GUICtrlCreateCheckbox("Let me choose updates to install", $spacer, $pos_y, $ctrl_width_full, $ctrl_height) GUICtrlSetBkColor($prog_Update[3][2], 0xd8d8d8) If $prog_Update[3][1] = 1 Then GUICtrlSetState($prog_Update[3][2], $GUI_CHECKED) If Not $set_adv Then GUICtrlSetState($prog_Update[3][2], $GUI_DISABLE) $pos_y += $ctrl_height $prog_Update[4][2] = GUICtrlCreateCheckbox("Hide unchecked important updates", $spacer, $pos_y, $ctrl_width_full, $ctrl_height) GUICtrlSetBkColor($prog_Update[4][2], 0xd8d8d8) If $prog_Update[4][1] = 1 Then GUICtrlSetState($prog_Update[4][2], $GUI_CHECKED) If Not $set_adv Then GUICtrlSetState($prog_Update[4][2], $GUI_DISABLE) If $prog_Update[3][1] = 0 Then GUICtrlSetState($prog_Update[4][2], $GUI_DISABLE) $pos_y += $ctrl_height $prog_Update[5][2] = GUICtrlCreateCheckbox("Send me notification when updates are ready", $spacer, $pos_y, $ctrl_width_full, $ctrl_height) GUICtrlSetBkColor($prog_Update[5][2], 0xd8d8d8) If $prog_Update[5][1] = 1 Then GUICtrlSetState($prog_Update[5][2], $GUI_CHECKED) If $prog_Update[3][1] = 0 Then GUICtrlSetState($prog_Update[5][2], $GUI_DISABLE) #EndRegion Choose updates $pos_y += $ctrl_height GUICtrlCreateGraphic($spacer, $pos_y + ($ctrl_height / 2), $ctrl_width_full, 1, $SS_BLACKRECT) $pos_y += $ctrl_height $prog_Update[6][2] = GUICtrlCreateCheckbox("Install drivers", $spacer, $pos_y, $ctrl_width_full, $ctrl_height) If $prog_Update[6][1] = 1 Then GUICtrlSetState($prog_Update[6][2], $GUI_CHECKED) If $prog_Update[3][1] = 1 Then GUICtrlSetState($prog_Update[6][2], $GUI_DISABLE) $pos_y += $ctrl_height $prog_Update[7][2] = GUICtrlCreateCheckbox("Send me notification when updates are finished", $spacer, $pos_y, $ctrl_width_full, $ctrl_height) If $prog_Update[7][1] = 1 Then GUICtrlSetState($prog_Update[7][2], $GUI_CHECKED) $pos_y += $ctrl_height GUICtrlCreateGraphic($spacer, $pos_y + ($ctrl_height / 2), $ctrl_width_full, 1, $SS_BLACKRECT) $pos_y += $ctrl_height GUICtrlCreateLabel("Send notification to:", $spacer, $pos_y + 4, $ctrl_width, $ctrl_height) $prog_Update[8][2] = GUICtrlCreateCombo("", $spacer + $ctrl_width, $pos_y, $ctrl_width_full - ($spacer + $ctrl_width), $ctrl_height, $WS_VSCROLL + $CBS_DROPDOWNLIST) GUISetState() ;activate control checking in loop for this child $p_R_update = True EndFunc ;==>GUIUpdate ;handle controls for child window Func SelectUpdates($nMsg) Local $temp #Region Choose updates If $nMsg = $prog_Update[3][2] Then If $prog_Update[3][1] = 0 Then IniWrite($path_progress, "Update", "Choose", 1) $prog_Update[3][1] = 1 GUICtrlSetState($prog_Update[4][2], $GUI_ENABLE) GUICtrlSetState($prog_Update[5][2], $GUI_ENABLE) GUICtrlSetState($prog_Update[6][2], $GUI_DISABLE) Else IniWrite($path_progress, "Update", "Choose", 0) $prog_Update[3][1] = 0 GUICtrlSetState($prog_Update[4][2], $GUI_DISABLE) GUICtrlSetState($prog_Update[5][2], $GUI_DISABLE) GUICtrlSetState($prog_Update[6][2], $GUI_ENABLE) EndIf EndIf #EndRegion Choose updates #Region Hide unchecked important If $nMsg = $prog_Update[4][2] Then If $prog_Update[4][1] = 0 Then IniWrite($path_progress, "Update", "HideUnchecked", 1) $prog_Update[4][1] = 1 Else IniWrite($path_progress, "Update", "HideUnchecked", 0) $prog_Update[4][1] = 0 EndIf EndIf #EndRegion Hide unchecked important #Region Notify when updates are ready If $nMsg = $prog_Update[5][2] Then If $prog_Update[5][1] = 0 Then If $prog_Update[8][1] = "" Then GUICtrlSetState($prog_Update[5][2], $GUI_UNCHECKED) MsgBox(262192, "Odin warning", "Select thy name first, brave warrior.") Else $prog_Update[5][1] = 1 EndIf Else $prog_Update[5][1] = 0 EndIf IniWrite($path_progress, "Update", "NotifyReady", $prog_Update[5][1]) EndIf #EndRegion Notify when updates are ready #Region Install drivers If $nMsg = $prog_Update[6][2] Then If $prog_Update[6][1] = 0 Then IniWrite($path_progress, "Update", "AutoDrivers", 1) $prog_Update[6][1] = 1 Else IniWrite($path_progress, "Update", "AutoDrivers", 0) $prog_Update[6][1] = 0 EndIf EndIf #EndRegion Install drivers #Region Notify when updates are finished If $nMsg = $prog_Update[7][2] Then If $prog_Update[7][1] = 0 Then If $prog_Update[8][1] = "" Then GUICtrlSetState($prog_Update[7][2], $GUI_UNCHECKED) MsgBox(262192, "Odin warning", "Select thy name first, brave warrior.") Else IniWrite($path_progress, "Update", "NotifyFinished", 1) $prog_Update[7][1] = 1 EndIf Else IniWrite($path_progress, "Update", "NotifyFinished", 0) $prog_Update[7][1] = 0 EndIf EndIf #EndRegion Notify when updates are finished #Region User selection If $nMsg = $prog_Update[8][2] Then $temp = GUICtrlRead($prog_Update[8][2]) If $temp <> $prog_Update[8][1] Then IniWrite($path_progress, "Update", "NotifyWho", $temp) $prog_Update[8][1] = $temp EndIf EndIf #EndRegion User selection EndFunc ;==>SelectUpdates ;set up Windows updates settings and do updates Func Do_Updates($nMsg = 0) Local $pos Local $txt_up1 Local $txt_up2 Local $txt_sel #Region Change setting for Windows Update to 'Check for updates but let me choose' If $prog_Update[1][1] = 0 Then $prog_Update[2][1] = _NowCalc() IniWrite($path_progress, "Update", "Timer", $prog_Update[2][1]) LogThis("========= Windows update started =========") LogThis("Setting up Windows Updater") $prog_Update[1][1] = 1 IniWrite($path_progress, "Update", "Phase", $prog_Update[1][1]) ElseIf $prog_Update[1][1] = 1 Then ConsoleWrite("phase 1 finished" & @CRLF) $prog_Update[1][1] = 2 IniWrite($path_progress, "Update", "Phase", $prog_Update[1][1]) #EndRegion Change setting for Windows Update to 'Check for updates but let me choose' ElseIf $prog_Update[1][1] = 2 Then FindUpdates() ConsoleWrite("phase 2 finished" & @CRLF) ElseIf $prog_Update[1][1] = 2.5 Then ElseIf $prog_Update[1][1] = 3 Then #Region Sorting buttons If $nMsg = $bnt_sort_T Then If $arr_updates[0][1] = 1 Then _ArraySort($arr_updates, 1, 1, 0, 0) $arr_updates[0][1] = 0 Else _ArraySort($arr_updates, 0, 1, 0, 0) $arr_updates[0][1] = 1 EndIf ChooseUpdates(1) ElseIf $nMsg = $bnt_sort_C Then If $arr_updates[0][1] = 2 Then _ArraySort($arr_updates, 1, 1, 0, 1) $arr_updates[0][1] = 0 Else _ArraySort($arr_updates, 0, 1, 0, 1) $arr_updates[0][1] = 2 EndIf ChooseUpdates(1) ElseIf $nMsg = $bnt_sort_S Then If $arr_updates[0][1] = 3 Then _ArraySort($arr_updates, 1, 1, 0, 2) $arr_updates[0][1] = 0 Else _ArraySort($arr_updates, 0, 1, 0, 2) $arr_updates[0][1] = 3 EndIf ChooseUpdates(1) EndIf #EndRegion Sorting buttons #Region Selecting individual updates For $f = 1 To $arr_updates[0][0] If $nMsg = $arr_updates[$f][4] Then If $arr_updates[$f][3] = 1 Then $arr_updates[0][2] -= $arr_updates[$f][2] If $arr_updates[0][2] > 1023 Then GUICtrlSetData($lbl_u_size, Round($arr_updates[0][2] / 1024, 1) & " MB") Else GUICtrlSetData($lbl_u_size, $arr_updates[0][2] & " KB") EndIf $arr_updates[0][3] -= 1 If $arr_updates[0][3] = 1 Then GUICtrlSetData($lbl_u_count, "1 update") Else GUICtrlSetData($lbl_u_count, $arr_updates[0][3] & " updates") EndIf $arr_updates[$f][3] = 0 Else $arr_updates[0][2] += $arr_updates[$f][2] If $arr_updates[0][2] > 1023 Then GUICtrlSetData($lbl_u_size, Round($arr_updates[0][2] / 1024, 1) & " MB") Else GUICtrlSetData($lbl_u_size, $arr_updates[0][2] & " KB") EndIf $arr_updates[0][3] += 1 If $arr_updates[0][3] = 1 Then GUICtrlSetData($lbl_u_count, "1 update") Else GUICtrlSetData($lbl_u_count, $arr_updates[0][3] & " updates") EndIf $arr_updates[$f][3] = 1 EndIf EndIf Next #EndRegion Selecting individual updates If $nMsg = $btn_u_install Then GUIDelete($GUI_choose_ch) GUIDelete($GUI_choose) $prog_Update[1][1] = 4 IniWrite($path_progress, "Update", "Phase", $prog_Update[1][1]) EndIf ElseIf $prog_Update[1][1] = 4 Then DownloadAndInstall() ElseIf $prog_Update[1][1] = 5 Then ;finish update stage $prog_Overall[2][1] = "Done" IniWrite($path_progress, "Overall", $prog_Overall[2][0], $prog_Overall[2][1]) ;restore default phase of updates $prog_Update[1][1] = 0 IniWrite($path_progress, "Update", "Phase", $prog_Update[1][1]) $prog_Update[2][1] = GetPhaseDuration(2) IniWrite($path_progress, "Update", "Timer", $prog_Update[2][1]) GUICtrlSetData($prog_Update[2][2], $prog_Update[2][1]) LogThis("========= Windows update finished ========") CheckNext() EndIf EndFunc ;==>Do_Updates ;create Microsoft.Update.Searcher and get updates into an array Func FindUpdates() Local $searchResult Local $ssWindowsUpdate = 2 Local $searcher Local $updateSession Local $choose = False If $prog_Update[3][1] = 1 Then $choose = True Local $obj_result Local $obj_updates Local $obj_categories Local $s_Cat Local $hide_stat Local $array[999][6] $array[0][0] = 0 $array[0][3] = 0 LogThis("Creating update searcher") $updateSession = ObjCreate("Microsoft.Update.Session") If @error Then LogThis("Error creating object, restarting function") Return EndIf LogThis("Starting update search") $searcher = $updateSession.CreateupdateSearcher() $searchResult = $searcher.Search("IsInstalled=0 and Type='Software' and IsHidden=0") LogThis("Sorting updates into an array") ;loop through all found updates For $i = 0 To $searchResult.Updates.Count - 1 $obj_categories = $searchResult.Updates.Item($i).Categories $obj_updates = $searchResult.Updates.Item($i) $s_Cat = "" $s_Cat = $obj_categories.Item(0).Name ;find the category If $s_Cat <> "Updates" Then ;filter optional updates If $choose Then #Region MANUAL updates ;=========== MANUAL updates =========== ;add to total size $array[0][0] += 1 ;selected and important updates If $s_Cat <> "Drivers" And $s_Cat <> "Feature Packs" Then $array[$array[0][0]][3] = 1 Else $array[$array[0][0]][3] = 0 EndIf #EndRegion MANUAL updates Else #Region AUTOMATIC updates ;=========== AUTOMATIC updates =========== ;if update was hidden and it`s not IE continue $hide_stat = $obj_updates.Item($i).IsHidden If $hide_stat Then If Not StringInStr($obj_updates.Item($i).Title, "Internet Explorer") Then ContinueLoop EndIf ;hide all Internet Explorers that are not required If StringInStr($obj_updates.Item($i).Title, "Internet Explorer") Then ;if IE 11 should be installed If $prog_Overall[3][1] = "Next" And $prog_IE[1][1] = "Yes" And StringInStr($obj_updates.Item($i).Title, "Internet Explorer 11", 1) Then If $debug Then ConsoleWrite("Internet Explorer 11 found") Else ;if IE 11 is not going to be installed, update current IE If Not StringInStr($obj_updates.Item($i).Title, "Internet Explorer " & Number(StringLeft(FileGetVersion(@ProgramFilesDir & "\Internet Explorer\iexplore.exe"), 2)), 1) Then If Not $hide_stat Then $obj_updates.Item($i).IsHidden = True LogThis($obj_updates.Item($i).Title & " update hidden") EndIf ContinueLoop EndIf EndIf Else ;filter updates depending on settings If $prog_Update[6][1] = 0 And $s_Cat = "Drivers" Then ContinueLoop ;drivers If $s_Cat = "Feature Packs" Then ContinueLoop EndIf ;add to total size $array[0][0] += 1 $array[$array[0][0]][3] = 1 #EndRegion AUTOMATIC updates EndIf ;check for EULA and accept if necessary If $obj_updates .EulaAccepted = false Then $obj_updates .AcceptEula() EndIf ;write data to array $array[$array[0][0]][0] = $obj_updates.Title $array[$array[0][0]][1] = $s_Cat $array[$array[0][0]][2] = Round($obj_updates.MaxDownloadSize / 1024) If $array[$array[0][0]][3] = 1 Then $array[0][2] += $array[$array[0][0]][2] $array[0][3] += 1 EndIf $array[$array[0][0]][5] = $obj_updates EndIf Next ReDim $array[$array[0][0] + 1][6] If $debug Then _ArrayDisplay($array, "Array of found updates") If $array[0][0] < 1 Then LogThis("No updates found") If $prog_Update[5][1] = 1 Then ; ConsoleWrite("No updates found, Odin shall continue his journey")) EndIf $prog_Update[1][1] = 5 IniWrite($path_progress, "Update", "Phase", $prog_Update[1][1]) Return EndIf $arr_updates = $array If $choose Then LogThis("Updates found, waiting for user selection") If $prog_Update[5][1] = 1 Then ; ConsoleWrite($prog_Update[8][1], "Updates are ready for selection") EndIf ChooseUpdates() $prog_Update[1][1] = 3 IniWrite($path_progress, "Update", "Phase", $prog_Update[1][1]) Else $prog_Update[1][1] = 4 IniWrite($path_progress, "Update", "Phase", $prog_Update[1][1]) EndIf Local $Timer1, $Delay1 = 5000 Local $Timer2, $Delay2 = 1000 While 1 If $Timer1 = '' Or TimerDiff($Timer1) > $Delay1 Then $Timer1 = TimerInit() MainLoop() EndIf If $Timer2 = '' Or TimerDiff($Timer2) > $Delay2 Then $Timer2 = TimerInit() FindUpdates() EndIf Sleep(100) WEnd EndFunc ;==>FindUpdates ;create GUI with all updates for user to choose Func ChooseUpdates($refresh = 0) Local $temp Local $lbl_height = 40 Local $chk_height = 20 Local $chk_width = 460 Local $cat_width = 100 Local $size_width = 80 Local $spacer_v = 2 Local $spacer_h = 10 Local $pos_v Local $gui_width = 2 * $spacer_h + $chk_width + $cat_width + $size_width + 20 Local $gui_height = 500 If $refresh = 0 Then $GUI_choose = GUICreate("Select updates", $gui_width, $gui_height, -1, -1, $WS_POPUP + $WS_CAPTION) $temp = GUICtrlCreateLabel("Select windows updates", 0, 5, 400, $lbl_height, $SS_CENTER) GUICtrlSetFont($temp, 20, 700) $btn_u_install = GUICtrlCreateButton("Install ---->", $gui_width - $cat_width - 20, 5, $cat_width, 30) GUICtrlSetFont($btn_u_install, 10, 800) $lbl_u_count = GUICtrlCreateLabel("", 420, 5, 80, 16) If $arr_updates[0][3] = 1 Then GUICtrlSetData($lbl_u_count, "1 update") Else GUICtrlSetData($lbl_u_count, $arr_updates[0][3] & " updates") EndIf GUICtrlSetFont($lbl_u_count, 8.5, 800) $lbl_u_size = GUICtrlCreateLabel("", 420, 20, 80, 20) If $arr_updates[0][2] > 1023 Then GUICtrlSetData($lbl_u_size, Round($arr_updates[0][2] / 1024, 1) & " MB") Else GUICtrlSetData($lbl_u_size, $arr_updates[0][2] & " KB") EndIf GUICtrlSetFont($lbl_u_size, 8.5, 800) GUICtrlCreateGraphic(0, $lbl_height, $gui_width, $spacer_v, $SS_BLACKFRAME) GUISetState() Else GUIDelete($GUI_choose_ch) Sleep(10) EndIf $GUI_choose_ch = GUICreate("", $gui_width, $gui_height - ($lbl_height + 5 + $spacer_v), 0, $lbl_height + 5 + $spacer_v, $WS_POPUP, $WS_EX_MDICHILD, $GUI_choose) _GUIScrollbars_Generate($GUI_choose_ch, 0, ($chk_height + $spacer_v) * ($arr_updates[0][0] + 1)) $bnt_sort_T = GUICtrlCreateButton("Sort by title", $spacer_h, 0, $chk_width, $chk_height + 4) GUICtrlSetBkColor($bnt_sort_T, 0xFFFFFF) $bnt_sort_C = GUICtrlCreateButton("Sort by category", $spacer_h + $chk_width, 0, $cat_width, $chk_height + 4) GUICtrlSetBkColor($bnt_sort_C, 0xFFFFFF) $bnt_sort_S = GUICtrlCreateButton("Sort by size", $spacer_h + $chk_width + $cat_width, 0, $size_width, $chk_height + 4) GUICtrlSetBkColor($bnt_sort_S, 0xFFFFFF) $pos_v = $chk_height + 4 GUICtrlCreateGraphic($spacer_h, $pos_v, $chk_width + $cat_width + $size_width, $spacer_v) $pos_v += 2 * $spacer_v For $i = 1 To $arr_updates[0][0] $arr_updates[$i][4] = GUICtrlCreateCheckbox($arr_updates[$i][0], $spacer_h, $pos_v + (($i - 1) * ($chk_height + $spacer_v)), $chk_width, $chk_height, -1, $WS_EX_CLIENTEDGE) If $arr_updates[$i][3] = 1 Then GUICtrlSetState($arr_updates[$i][4], $GUI_CHECKED) ;check if Internet Explorer will be installed If $prog_Overall[3][1] = "Next" And $prog_IE[1][1] = "Yes" And StringInStr($arr_updates[$i][0], "Internet Explorer 11") Then GUICtrlSetState($arr_updates[$i][4], $GUI_DISABLE) GUICtrlCreateLabel($arr_updates[$i][1], $chk_width + $spacer_h, $pos_v + (($i - 1) * ($chk_height + $spacer_v)), $cat_width, $chk_height, $SS_RIGHT, $WS_EX_CLIENTEDGE) If $arr_updates[$i][2] > 1023 Then GUICtrlCreateLabel(Round($arr_updates[$i][2] / 1024, 1) & " MB", $chk_width + $spacer_h + $cat_width, $pos_v + (($i - 1) * ($chk_height + $spacer_v)), $size_width, $chk_height, $SS_RIGHT, $WS_EX_CLIENTEDGE) Else GUICtrlCreateLabel($arr_updates[$i][2] & " KB", $chk_width + $spacer_h + $cat_width, $pos_v + (($i - 1) * ($chk_height + $spacer_v)), $size_width, $chk_height, $SS_RIGHT, $WS_EX_CLIENTEDGE) EndIf Next GUISetState() EndFunc ;==>ChooseUpdates Func DownloadAndInstall() ;check if update array exists If Not IsArray($arr_updates) Then LogThis("Update array doesn`t exists, restarting update phase") $prog_Update[1][1] = 2 IniWrite($path_progress, "Update", "Phase", $prog_Update[1][1]) Return EndIf Local $obj_coll LogThis("Creating update session") Local $obj_sess = ObjCreate("Microsoft.Update.Session", @ComputerName) If @error Then LogThis("Error creating object, restarting function") Return EndIf Local $session_install Local $hide_stat Local $result Local $reboot = False LogThis("Creating update downloader") Local $session_download = $obj_sess.CreateUpdateDownloader() LogThis("Starting to download updates") $arr_updates[0][1] = 1 For $c = 1 To $arr_updates[0][0] ;skip if update is not selected and hide if requested If $arr_updates[$c][3] = 0 Then If $prog_Update[3][1] = 1 And $prog_Update[4][1] = 1 Then $hide_stat = $arr_updates[$c][5].IsHidden If Not $hide_stat Then $arr_updates[$c][5].IsHidden = True EndIf ContinueLoop EndIf UpdateInstallData() $obj_coll = ObjCreate("Microsoft.Update.UpdateColl") If @error Then LogThis("Error creating object, restarting function") Return EndIf $obj_coll.Add($arr_updates[$c][5]) $session_download.Updates = $obj_coll $session_download.Download $arr_updates[0][4] += 1 Next LogThis("Downloading updates finished") LogThis("Creating update installer") Local $session_install = $obj_sess.CreateUpdateInstaller() LogThis("Starting to install updates") $arr_updates[0][1] = 2 For $d = 1 To $arr_updates[0][0] ;skip if update is not selected If $arr_updates[$d][3] <> 1 Then ContinueLoop If Not $arr_updates[$d][5].IsDownloaded Then LogThis($arr_updates[$d][0] & " is not downloaded yet") ContinueLoop EndIf UpdateInstallData() $obj_coll = ObjCreate("Microsoft.Update.UpdateColl") If @error Then LogThis("Error creating object, restarting function") Return EndIf $session_install.Updates = $obj_coll $obj_coll.Add($arr_updates[$d][5]) $result = $session_install.Install If $result.RebootRequired Then $reboot = True $arr_updates[0][5] += 1 Next LogThis("Update installation finished") If $prog_Update[3][1] = 1 Then $prog_Update[1][1] = 5 IniWrite($path_progress, "Update", "Phase", $prog_Update[1][1]) Else LogThis("Will check for updates again after reboot") $prog_Update[1][1] = 2 IniWrite($path_progress, "Update", "Phase", $prog_Update[1][1]) EndIf If $reboot Then LogThis("Reboot required") If $prog_Overall[3][1] = "Next" Then AllowEXE(1, 0) LogThis("Rebooting system now") Shutdown(6) Exit EndFunc ;==>DownloadAndInstall ;~