Old 12th September 2017, 15:42   #1
Kuppy
Junior Member
 
Join Date: Sep 2016
Posts: 34
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:
PHP Code:
{DFF3874A-9AE8-40BF-AA59-112296C92571
PHP Code:
  FileOpen $"$EXEDIR\File.txt" w
  FileWrite 
$"{DFF3874A-9AE8-40BF-AA59-112296C92571}"
  
FileClose $0

  StrCpy 
$""
  
FileOpen $"$EXEDIR\File.txt" "r"
  
read:
   
ClearErrors
   FileRead 
$$1
   IfErrors close
   StrCpy 
$$1 1
   StrCmp 
$"{" found read
   found
:
     
StrCpy $$"" 1
       
goto close
  close
:
  
MessageBox MB_ICONEXCLAMATION "$3"
  
FileClose $0

  FileOpen 
$"$EXEDIR\File.txt" w
  FileWrite 
$`$3`
  
FileClose $0

  StrCpy 
$""
  
FileOpen $"$EXEDIR\File.txt" "r"
  
_read:
  
ClearErrors
  FileRead 
$$1
  IfErrors _close
  StrCpy 
$$-1
  StrCmp 
$"}" _found _read
  _found
:
    
StrCpy $$"" -1
      
goto _close
  _close
:
  
MessageBox MB_ICONEXCLAMATION "$4"
  
FileClose $0

  FileOpen 
$"$EXEDIR\File.txt" w
  FileWrite 
$`$4`
  
FileClose $
Kuppy is offline   Reply With Quote
Old 13th September 2017, 11:53   #2
Anders
Moderator
 
Anders's Avatar
 
Join Date: Jun 2002
Location: ${NSISDIR}
Posts: 4,578
FileRead probably includes line ending character(s) you need to remove first.

IntOp $PostCount $PostCount + 1
Anders is offline   Reply With Quote
Reply
Go Back   Winamp & SHOUTcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump