Skip to content
⌘ NSIS Forum Archive

How can I read a text with NSIS?

2 posts

Kuppy#

How can I read a text with NSIS?

This text includes a string of characters to two accolade that I want deleted from the text.
I tried some methods but I can not but remove the first accolade, not the last one
Example:
{DFF3874A-9AE8-40BF-AA59-112296C92571} 
  FileOpen $0 "$EXEDIR\File.txt" w
  FileWrite $0 "{DFF3874A-9AE8-40BF-AA59-112296C92571}"
  FileClose $0
  StrCpy $3 ""
  FileOpen $0 "$EXEDIR\File.txt" "r"
  read:
   ClearErrors
   FileRead $0 $1
   IfErrors close
   StrCpy $3 $1 1
   StrCmp $3 "{" found read
   found:
     StrCpy $3 $1 "" 1
       goto close
  close:
  MessageBox MB_ICONEXCLAMATION "$3"
  FileClose $0
  FileOpen $0 "$EXEDIR\File.txt" w
  FileWrite $0 `$3`
  FileClose $0
  StrCpy $4 ""
  FileOpen $0 "$EXEDIR\File.txt" "r"
  _read:
  ClearErrors
  FileRead $0 $1
  IfErrors _close
  StrCpy $4 $1 -1
  StrCmp $4 "}" _found _read
  _found:
    StrCpy $4 $1 "" -1
      goto _close
  _close:
  MessageBox MB_ICONEXCLAMATION "$4"
  FileClose $0
  FileOpen $0 "$EXEDIR\File.txt" w
  FileWrite $0 `$4`
  FileClose $0