+ # The problem is now that LaTeX might need several runs and therefore the PDF can
+ # also be rewritten consecutively several times.
+ # If we would directly open the file we will get in troubles as the PDF can be
+ # unreadable. We also don't know the time of a LaTeX run.
+ # (As example take UserGuide.lyx, view it, then remove a letter in a section heading
+ # and finally update the view.)
+ # We therefore loop until the PDF is no longer changed and wait some time in each loop.
+ ${Do}
+ CopyFiles /SILENT $OriginalFile $PDFFile
+ # wait 1.666 seconds (is empirically enough time that the PDF can be changed)
+ Sleep 1666
+ ${FileTimeDiff} $TimeDiff "$PDFFile" "$OriginalFile"
+ ${LoopUntil} $TimeDiff = 0
+
+ # open the new file
+ !insertmacro HideConsole '"$EXEDIR\pdfopen.exe" --file "$PDFFile"'