1. ${SegmentFile}
  2.  
  3. ${SegmentPreExec}
  4. #
  5. # Code courtesy of Bart.S
  6. #
  7.     ${registry::Read} "HKEY_CURRENT_USER\Software\Ulduzsoft\kchmviewer" "recentFileList" $R0 $R1
  8.     StrLen $1 $R0
  9.     ${If} $R1 == "REG_MULTI_SZ"
  10.     ${AndIf} $1 > 3 ; Test for empty value
  11.         StrCpy $2 ''
  12.         ${Do}
  13.             StrCpy $0 $R0 1 -$1 ; Get every ...
  14.             IntOp $1 $1 - 2     ; second character.
  15.             StrCpy $2 $2$0      ; Add this character to the string
  16.         ${LoopUntil} $1 == 2        ; 2 = ignore the last character, another bug
  17.         StrCpy $R0 $2
  18.     ${EndIf}
  19.  
  20.         MessageBox MB_OK 'Value=$R0'
  21.         MessageBox MB_OK 'Type=$R1'
  22.     ${If} $R0 != ""
  23.         ${WordReplace} $R0 "%PAL:LastDrive%" "%PAL:Drive%" "E+" $R2
  24.         ${If} ${Errors}
  25.             MessageBox MB_OK 'Errorlevel=$R2'
  26.         ${Else}
  27.             MessageBox MB_OK 'No errors'
  28.         ${EndIf}
  29.        
  30.         ${registry::Write}  "HKEY_CURRENT_USER\Software\Ulduzsoft\kchmviewer" "recentFileList" "$R0" "$R1" $R3
  31.         MessageBox MB_OK 'Value=$R0'
  32.     ${EndIf}
  33. !macroend