PDA

View Full Version : Handle Text File Operation



mario.capin
08-20-2015, 05:03 AM
Hi,

I want to proof if crystal report modules installation has successfully finished. I know if not, there will be written a lof file in kind of this:

=== Logging started: 21.07.2015 23:07:56 ===
Error 1904. Module C:\Program Files\Business Objects\BusinessObjects Enterprise 11\win32_x86\plugins\auth\secLDAP\secldap.dll failed to register. HRESULT -2147024770. Contact your support personnel.
=== Logging stopped: 21.07.2015 23:08:30 ===

On successful installation:

=== Logging started: 21.07.2015 23:07:56 ===
=== Logging stopped: 21.07.2015 23:08:30 ===

My solution strategy:

Set Variable %_UD_CR_LOG_FILE% to "%_SB_INSTALLDIR%\crystal.log"
Run Program [_UD_UPDATES_PATH]\CrystalReportModules.exe /passive /le "%_UD_CR_LOG_FILE%" (Always Install) [Wait]
! Handle Crystal Reports Installation Fail
Set Variable %_UD_CR_LOG_LINE_NUMBERS% to FUNCTION:Count Lines from "%_UD_CR_LOG_FILE%"
Set Variable %_UD_CR_LOG_LINE2% to FUNCTION:Get Line "2" from "%_UD_CR_LOG_FILE%"
If %_UD_CR_LOG_LINE_NUMBERS% Greater Than "2" Then
Display Message Box "This setup will instal the demo version of %_UD_PR..." -- "Crystal Reports Installation Fail"
Exit Installation()
Else
Display Message Box "%_UD_CR_LOG_FILE%\n%_UD_CR_LOG_LINE_NUMBERS%\n%_UD ..." -- "Crystal Reports installation succeed"
End

My first problem is, that the count-lines-function deliveres 1?! If I display the first line on crystal reports installation success by message box there will be shown cryptic signs.

What's wrong?

Best regards,
Mario