Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;---------------------------------------------
- ; ChromeUpdates.ahk
- ; Enable or disable Google Chrome updates.
- ; adapted to AutoHotkey by Mgis
- ; based on SetChromeUpdates.ps1 version by Jared M. Smith 2015.04.xx
- ; https://gist.github.com/absynce/7667bd32e632e72f406f
- ;---------------------------------------------
- MsgBox,% 3+256,What to do?,Enable Chrome Updates? Choosing No will disable them.
- IfMsgBox,cancel
- return
- IfMsgBox,yes
- decision:=true
- IfMsgBox,no
- decision:=false
- if SetChromeUpdates(decision)
- MsgBox,,Done,Settings applied successfully,3
- else
- MsgBox,,Failed,Settings could not be applied,3
- return ;autoexec
- SetChromeUpdates(allowChromeUpdates:=false)
- {
- if (!allowChromeUpdates)
- updateText := "Disabling"
- else
- updateText := "Enabling"
- ;no need for Enable/disable Chrome updates integer value
- notAllowChromeUpdates := !allowChromeUpdates
- Log(updateText . " Google Chrome updates.")
- RegWrite, REG_DWORD, HKLM, SOFTWARE\Policies\Google,, %allowChromeUpdates% ;this will set default value
- RegWrite, REG_DWORD, HKLM, SOFTWARE\Policies\Google, Update, %allowChromeUpdates% ;this will set Update value
- RegWrite, REG_DWORD, HKLM, SOFTWARE\Policies\Google\Update,, %allowChromeUpdates% ;this will set default value
- RegWrite, REG_DWORD, HKLM, SOFTWARE\Policies\Google\Update, AutoUpdateCheckPeriodMinutes, %allowChromeUpdates%
- RegWrite, REG_DWORD, HKLM, SOFTWARE\Policies\Google\Update, DisableAutoUpdateChecksCheckboxValue, %notAllowChromeUpdates%
- RegWrite, REG_DWORD, HKLM, SOFTWARE\Policies\Google\Update, Update{8A69D345-D564-463C-AFF1-A69D9E530F96}, %allowChromeUpdates%
- RegWrite, REG_DWORD, HKLM, SOFTWARE\Policies\Google\Update, UpdateDefault, %allowChromeUpdates%
- Log("Added registry keys for " . updateText . " Google updates.")
- if (allowChromeUpdates) {
- RunWait,%comspec% /c "net start gupdate",,hide
- RunWait,%comspec% /c "net start gupdatem",,hide
- Log("Attempted to start Google update services(s).")
- } else {
- RunWait,%comspec% /c "net stop gupdate",,hide
- RunWait,%comspec% /c "net stop gupdatem",,hide
- Log("Stopped Google update services(s).")
- }
- return true
- }
- Log(str)
- {
- static s
- s.=str . "`n"
- ToolTip,%s%
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement