sumatrapdfreader / sumatrapdf

SumatraPDF reader
http://www.sumatrapdfreader.org
GNU General Public License v3.0
13.71k stars 1.73k forks source link

update per-realise version with Command-line arguments #4481

Closed Aliaksandr3by closed 3 months ago

Aliaksandr3by commented 3 months ago

update per-realise version with Command-line arguments something like image

GitHubRulesOK commented 3 months ago

use -help

SumatraPDF-16759-32-install.exe -help

C:\Users\lez\Downloads\Apps\PDF\SumatraPDF\16759>SumatraPDF installer options:
[-s] [-d <path>] [-with-filter] [-with-preview] [-x]

-s
    installs SumatraPDF silently (without user interaction)
-d
    set installation directory
-with-filter
    install search filter
-with-preview
    install shell preview
-x
    extracts the files, doesn't install
-log
    writes installation log to %LOCALAPPDATA%\sumatra-install-log.txt

See more at https://www.sumatrapdfreader.org/docs/Installer-cmd-line-arguments

what is not listed is -help ! and https://github.com/sumatrapdfreader/sumatrapdf/issues/4434#issuecomment-2267554987

SumatraPDF.exe -fast-install -log should do exactly same thing as auto-update but with log.

Aliaksandr3by commented 3 months ago

I want to update the portable pre-realise file with command line

image

GitHubRulesOK commented 3 months ago

Interesting concept as SumatraPDF must be running to rewrite itself (generally not allowed by the OS) but done via a temp download and close self

You could try to DDE CmdCheckUpdate but then who presses the internal button to allow a self destruct?

simplest is CURL -o SumatraPDF.exe where target is the online current version (then copy over existing copy /y %latest%\SumatraPDF-%latest%-32.exe I do that daily but it should not be a public methodology)

Aliaksandr3by commented 3 months ago

I understand, to Need external downloaded. like powershell Invoke-WebRequest -Uri "https://www.sumatrapdfreader.org/dl/prerel/16759/SumatraPDF-prerel-64.exe" -OutFile "E:\_SOFT\SumatraPDF\.MAIN\SumatraPDF-prerel-64.exe"

problem with the version 16759 if exist link with link of the latest version https://www.sumatrapdfreader.org/dl/prerel/%the latest version%/SumatraPDF-prerel-64.exe

GitHubRulesOK commented 3 months ago

My problem is one of not making it plain how such automation may be done so it is no secret but I dont wish to decide how public it should be as it then becomes abused.

@kjk is it reasonable to add such a command line trigger to Standalone version ? or did I miss one ? the diagnostic one fails me with

'The process cannot access the file because it is being used by another process.'
U..o: failed to copy self to file

but does download the standalone version then self destructs.

Aliaksandr3by commented 3 months ago

you might did external updater with the google capcha?

I use GIT for saving all SumatraPDF-settings.txt files, and using many SumatraPDF-prerel-64.exe for every theme like SumatraPDF_COOK_EN, SumatraPDF_LG_ENG_SOCIAL and other

for me a good idea using a single ps1 with all code: add GIT changes, update *.exe

`Clear-Host

Write-Output "add git changes"

git status git add -A git commit -m "$(Get-Date)"

Invoke-WebRequest -Uri "https://www.sumatrapdfreader.org/dl/prerel/16759/SumatraPDF-prerel-64.exe" -OutFile "..MAIN\SumatraPDF-prerel-64.exe" `

`E:_SOFT\SUMATRAPDF .gitignore copy.ps1 getTree.ps1 MISSSING.txt output.txt testFoundBooks.py
+---.MAIN SumatraPDF-prerel-64.exe SumatraPDF-settings.txt
+---.vscode launch.json settings.json
+---SumatraPDF_BUILD SumatraPDF-3.5.2-64.exe SumatraPDF-prerel-64.exe SumatraPDF-settings.txt

|
---SumatraPDF_SQL SumatraPDF-3.5.2-64.exe SumatraPDF-prerel-64.exe SumatraPDF-settings.txt`

GitHubRulesOK commented 3 months ago

@Aliaksandr3by by far the simplest is Windows Curl so no need for wget or powershell and there is an update command but I dont wish to make it simple without @kjk answering. Personally I have problems with auto-update compared to simpler download afresh.

GitHubRulesOK commented 3 months ago

@Aliaksandr3by The command to manually check from a command line should be simply SumatraPDF.exe -dde [CmdCheckUpdate] which opens SumatraPDF and tests if it is the latest so will stop with dialog either image or the update is required image

but I cant get that to work consistently, without adding a 2 second timeout. Sumatrapdf & timeout 2 & SumatraPDF.exe -dde [CmdCheckUpdate]

Both of which dialogs will require deliberate intervention with "enter" and then you would need to send a close command.

Aliaksandr3by commented 2 months ago

it is work only if the SumatraPDF is opened. if I use only powershell (without only opened instance of PDFreader) it do nothing. image

mayby your site has a txt with latest version of SumatraPDF ? something like https://www.sumatrapdfreader.org/prerelease/latestversion.txt then I can to fetch this one and construct all link image

GitHubRulesOK commented 2 months ago

it is work only if the SumatraPDF is opened.

You can see in my command I call SumatraPDF first so it is DDE serving, but on this slow machine since it may be loading previous session I wait 2 seconds before call the dde cmd.

You second suggestion to fetch "latest" is what I use daily so is how SumatraPDF knows it needs update and thus the faster better method. you can inspect the daily upload to see where it is published but of the 4 locations only one has the value used as a single file and often has to change so look for /software/sumatrapdf/sumpdf-prerelease-latest.txt the clues are in https://github.com/sumatrapdfreader/sumatrapdf/issues/3020#issuecomment-1321412033