- !insertmacro HideConsole '"$EXEDIR\pdfopen.exe" --back --file "$PDFFile"'
-
- # Monitor for updates of the original file
- GetFileTime $OriginalFile $OriginalTimeHigh $OriginalTimeLow
- !insertmacro SystemCall "kernel32::FindFirstChangeNotification(t '$OriginalDir', \
- i 0, i ${FILE_NOTIFY_CHANGE_LAST_WRITE}) i.s"
- Pop $ChangeNotification
-
- ${Do}
-
- !insertmacro SystemCall "kernel32::WaitForSingleObject(i $ChangeNotification, i 10000) i.s"
- Pop $WaitReturn
-
- # Check whether a lock is still active.
- # If not, Adode Reader is closed and we can close this application as well
-
- FileOpen $LockedFile $PDFFile a
-
- ${If} $LockedFile != ""
- # Quit this application
- FileClose $LockedFile
- Delete $PDFFile
- !insertmacro SystemCall "kernel32::FindCloseChangeNotification(i $ChangeNotification)"
- Quit
- ${EndIf}
-
- ${IfNot} $WaitReturn = ${WAIT_TIMEOUT}
- # The LyX tmpbuf has been updated
- # Check whether it's the PDF file that has been updated
-
- GetFileTime $OriginalFile $CurrentTimeHigh $CurrentTimeLow
-
- ${if} $OriginalTimeHigh != $CurrentTimeHigh
- ${orif} $OriginalTimeLow != $CurrentTimeLow
- # PDF has been modified, update view
- !insertmacro HideConsole '"$EXEDIR\pdfclose.exe" --file "$PDFFile"'
- CopyFiles /SILENT $OriginalFile $PDFFile
- !insertmacro HideConsole '"$EXEDIR\pdfopen.exe" --back --file "$PDFFile"'
-
- # Time of new file
- StrCpy $OriginalTimeHigh $CurrentTimeHigh
- StrCpy $OriginalTimeLow $CurrentTimeLow
- ${EndIf}
-
- #Monitor again
- !insertmacro SystemCall "kernel32::FindNextChangeNotification(i $ChangeNotification)"
-
- ${EndIf}
-
- ${Loop}