Page 2 of 2

Re: Silent Install

Posted: July 19th, 2021, 4:20 pm
by Yincognito
Jeff wrote: July 19th, 2021, 3:06 pm Oooo now I can finally share this trick
http://rainmeter.github.io/rainmeter/status.json
If you wanna automatically update Rainmeter when a new version appears, use this site to get the latest version.
I only see final version details there, not the latest beta info. Is it supposed to be like that, especially for Rainmeter?
Jeff wrote: July 19th, 2021, 3:06 pmRight now Rainmeter only tells you in the corner there's a new version when it happens and that's all...
Which corner? In the program itself or on GitHub?

--------

Personally, I would see a good usage case for the silent install in situations in which a skin one installs needs a certain Rainmeter version and up to function properly. Then, the said skin could check if the user's version is greater than the required version and if not, install the latest or the required, instead of not allowing the user to proceed further, like it is now.

Not sure if this would be desirable, secure, and all that though. If not, the blocking window itself could implement a small script & link to install the required or latest Rainmeter version, instead of just stating one should visit Rainmeter.net to do it. Nothing wrong with visiting Rainmeter.net, of course, the said user could even be a frequent visitor here, I'm just talking about the easiness to get the environment needed for such a skin to install.

Re: Silent Install

Posted: July 19th, 2021, 5:02 pm
by death.crafter
Yincognito wrote: July 19th, 2021, 4:20 pm Which corner? In the program itself or on GitHub?
The notification flyer. Or toaster. Whatever you know it as.
Yincognito wrote: July 19th, 2021, 4:20 pm Personally, I would see a good usage case for the silent install in situations in which a skin one installs needs a certain Rainmeter version and up to function properly. Then, the said skin could check if the user's version is greater than the required version and if not, install the latest or the required, instead of not allowing the user to proceed further, like it is now.
Tho possible, it should not be done by skin authors. And should be cautioned by the devs. If someone is not willing to get beta, I personally wouldn't want to force them.

But you can just ask for permission and run a script.

Code: Select all

$jsonHash=Invoke-WebRequest -Uri "https://api.github.com/repos/rainmeter/rainmeter/releases" -UseBasicParsing | ConvertFrom-Json

Start-BitsTransfer -Source $jsonHash.assets.browser_download_url[0] -Destination "$($env:Temp)\Rainmeter.exe"

Start-Process -FilePath "$($env:Temp)\Rainmeter.exe" -ArgumentList "/S /LANGUAGE=1033 /PORTABLE=0 /VERSION=64 /AUTOSTARTUP=1 /D=`"$($env:ProgramFiles)\Rainmeter`"" -verb runas

Start-Sleep -s 2

Start-Process -FilePath "$($env:ProgramFiles)\Rainmeter\Rainmeter.exe" -WorkingDirectory "$($env:ProgramFiles)\Rainmeter"

Start-Sleep -s 1
This downloads the latest Rainmeter and installs it silently. StealthMode 8-)

Re: Silent Install

Posted: July 19th, 2021, 5:16 pm
by Yincognito
death.crafter wrote: July 19th, 2021, 5:02 pmTho possible, it should not be done by skin authors. And should be cautioned by the devs. If someone is not willing to get beta, I personally wouldn't want to force them.

But you can just ask for permission and run a script.

Code: Select all

$jsonHash=Invoke-WebRequest -Uri "https://api.github.com/repos/rainmeter/rainmeter/releases" -UseBasicParsing | ConvertFrom-Json

Start-BitsTransfer -Source $jsonHash.assets.browser_download_url[0] -Destination "$($env:SYSTEMDRIVE)\temp\Rainmeter.exe"

Start-Process -FilePath "$($env:SYSTEMDRIVE)\temp\Rainmeter.exe" -ArgumentList "/S /LANGUAGE=1033 /PORTABLE=0 /VERSION=64 /AUTOSTARTUP=1 /D=`"$($env:ProgramFiles)\Rainmeter`"" -verb runas

Start-Sleep -s 2

Start-Process -FilePath "$($env:ProgramFiles)\Rainmeter\Rainmeter.exe" -WorkingDirectory "$($env:ProgramFiles)\Rainmeter"

Start-Sleep -s 1
This downloads the latest Rainmeter and installs it silently. StealthMode 8-)
Of course, I meant with the user's permission and all. Nice script, by the way - so simple to do it. :thumbup:

Re: Silent Install

Posted: July 19th, 2021, 7:08 pm
by death.crafter
Now that there is silent install, things can be done.

Direct install:

Code: Select all

# gets data about latest releases and converts to a hash table
$jsonHash=Invoke-WebRequest -Uri "https://api.github.com/repos/rainmeter/rainmeter/releases" -UseBasicParsing | ConvertFrom-Json

$latestVersion=$jsonHash.tag_name[0] -replace 'v', ''

$Update_Rainmeter = {

    Write-Host Downloading Rainmeter v$latestVersion ...
    Start-BitsTransfer -Source $jsonHash.assets.browser_download_url[0] -Destination "$($env:Temp)\Rainmeter.exe"

    Start-Process -FilePath "$($env:Temp)\Rainmeter.exe" -ArgumentList "/S /LANGUAGE=1033 /PORTABLE=0 /VERSION=64 /AUTOSTARTUP=1 /D=`"$($env:ProgramFiles)\Rainmeter`"" -verb runas

    # Fancy progress bar
    $messages=@('Starting installation...', 'Midway there...', 'Almost complete...', 'Installation complete!')
    for ($i=0 ; $i -le 100; $i++) {
        Write-Progress -Activity $messages[[math]::Floor($i/33)] -Status "$i% Complete:" -PercentComplete $i -Id 0
        Start-Sleep -Milliseconds 40
    }
    Write-Progress -Activity Completed -Id 0 -Completed

    Write-Host Removing installer...
    Remove-Item "$($env:Temp)\Rainmeter.exe"

    Write-Host Starting Rainmeter
    Start-Sleep 2
    Start-Process -FilePath "$($env:ProgramFiles)\Rainmeter\Rainmeter.exe" -WorkingDirectory "$($env:ProgramFiles)\Rainmeter"

    Write-Host 'Done!'
    
    Start-Sleep 2
    Stop-Process $PID
}

$currentVersion=[System.Diagnostics.FileVersionInfo]::GetVersionInfo("$($env:ProgramFiles)\Rainmeter\Rainmeter.exe").FileVersion

$m=0

for ($i=0; $i -lt 4; $i++) {
    if ([convert]::ToInt32(($latestVersion -split '\.')[$i]) -gt [convert]::ToInt32(($currentVersion -split '\.')[$i])) {
        $m++
    break
    }
}

if ($m -gt 0) {
    Write-Host Update Found!
    Start-Sleep 1
    Write-Host Updating Rainmeter ...
    Start-Sleep -Milliseconds 500
    &($Update_Rainmeter)
} else {
    Write-Host 'No updates found!'
    Start-Sleep 3
    Stop-Process $PID
}
"Ask for permission" version(if you want to use in a skin):

Code: Select all

# gets data about latest releases and converts to a hash table
$jsonHash=Invoke-WebRequest -Uri "https://api.github.com/repos/rainmeter/rainmeter/releases" -UseBasicParsing | ConvertFrom-Json

$latestVersion=$jsonHash.tag_name[0] -replace 'v', ''

$Update_Rainmeter = {

    Write-Host Downloading Rainmeter v$latestVersion ...
    Start-BitsTransfer -Source $jsonHash.assets.browser_download_url[0] -Destination "$($env:Temp)\Rainmeter.exe"

    Start-Process -FilePath "$($env:Temp)\Rainmeter.exe" -ArgumentList "/S /LANGUAGE=1033 /PORTABLE=0 /VERSION=64 /AUTOSTARTUP=1 /D=`"$($env:ProgramFiles)\Rainmeter`"" -verb runas

    # Fancy progress bar
    $messages=@('Starting installation...', 'Midway there...', 'Almost complete...', 'Installation complete!')
    for ($i=0 ; $i -le 100; $i++) {
        Write-Progress -Activity $messages[[math]::Floor($i/33)] -Status "$i% Complete:" -PercentComplete $i -Id 0
        Start-Sleep -Milliseconds 40
    }
    Write-Progress -Activity Completed -Id 0 -Completed

    Write-Host Removing installer...
    Remove-Item "$($env:Temp)\Rainmeter.exe"

    Write-Host Starting Rainmeter
    Start-Sleep 2
    Start-Process -FilePath "$($env:ProgramFiles)\Rainmeter\Rainmeter.exe" -WorkingDirectory "$($env:ProgramFiles)\Rainmeter"

    Write-Host 'Done!'

    Start-Sleep 2
    Stop-Process $PID

}

$currentVersion=[System.Diagnostics.FileVersionInfo]::GetVersionInfo("$($env:ProgramFiles)\Rainmeter\Rainmeter.exe").FileVersion

$m=0

for ($i=0; $i -lt 4; $i++) {
    if ([convert]::ToInt32(($latestVersion -split '\.')[$i]) -gt [convert]::ToInt32(($currentVersion -split '\.')[$i])) {
        $m++
    break
    }
}

if ($m -gt 0) {
    Write-Host Update Found!
    Start-Sleep 1

    # confirmation block
    $confirmation = Read-Host "Are you Sure You Want To Proceed: (Y or N)"
    if ($confirmation -eq 'Y') {
        Write-Host Updating Rainmeter ...

        Start-Sleep -Milliseconds 500
    
        &($Update_Rainmeter)
    } else {
        Write-Host "Aborted!"
        Start-Sleep 2
        Stop-Process $PID
    }

} else {

    Write-Host 'No updates found!'
    Start-Sleep 3
    Stop-Process $PID
}
Click to animate:
ezgif-7-097a31d3161e.gif
If someone is lazy:
RainUpdater.zip
RainUpdaterConfirm.zip

Re: Silent Install

Posted: July 21st, 2021, 10:16 pm
by jsmorley
We have changed things in the new beta r3504:

1) It is no longer required to run the installer "As Administrator". If the installer is run without elevation, it will pop up a UAC confirmation prompt when run. If you need truly "silent" operation, you will still need to run "As Administrator", or install portable.

2) Rainmeter will now restart after the install is complete, IF Rainmeter was running when the installation was started. This behavior can be overridden with a new /RESTART=0/1 option.

https://docs.rainmeter.net/manual-beta/installing-rainmeter/#SilentInstallation

Re: Silent Install

Posted: July 21st, 2021, 10:26 pm
by Yincognito
jsmorley wrote: July 21st, 2021, 10:16 pmWe have changed things in the new beta r3504
Probably not worth bothering you with such minor details, but there's a tiny tiny typo here for r3504: restart instead of retart. Hopefully I'm not a "retart" for mentioning this. :lol:

Re: Silent Install

Posted: July 21st, 2021, 10:28 pm
by jsmorley
Yincognito wrote: July 21st, 2021, 10:26 pm Probably not worth bothering you with such minor details, but there's a tiny tiny typo here for r3504: restart instead of retart. Hopefully I'm not a "retart" for mentioning this. :lol:
Fixed. Thanks.

Re: Silent Install

Posted: July 21st, 2021, 10:32 pm
by Yincognito
jsmorley wrote: July 21st, 2021, 10:28 pmFixed. Thanks.
No problem - nice addition to Rainmeter. :thumbup: