Old 26th April 2010, 21:19   #1
xbarns
Senior Member
 
xbarns's Avatar
 
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 187
WordFind "Skipping" Delimiters

Hi all,

i am using

${WordFind} "$1" "," "E+1" $Firstname
${WordFind} "$1" "," "E+2" $Lastname
${WordFind} "$1" "," "E+4" $Workphone
${WordFind} "$1" "," "E+9" $Phone
${WordFind} "$1" "," "E+12" $Mobile

to parse a Thunderbird Adressbok CSV export, for example from the line below i want FirstName, Lastname, workphone and so on:

Alfonso,Affetuoso,AffetuosoAlfonso,,,,,+496101111111,,,,+49610111111,,,,,,,,,,,,,,,,,,,,,,,,pas-id-2892B1D448BC91DD,,

it seems though that multiple " , " are treated as one so of course i do get an error sometimes when going for the higher word counts.

Can i tell wordfind to treat every "," as a delimiter so no matter how many "empty" words there are it does not "combine" delimiters?

Thanks for your help.
xbarns is offline   Reply With Quote
Old 27th April 2010, 07:23   #2
Instructor
Major Dude
 
Join Date: Jul 2004
Posts: 671
PHP Code:
Name "Test"
OutFile "Test.exe"

!include "WordFunc.nsh"
!insertmacro WordFind

Var Firstname
Var Lastname
Var Workphone
Var Phone
Var Mobile

Section
    StrCpy 
$"Alfonso,Affetuoso,AffetuosoAlfonso,,,,,+496101111111,,,,+49610111111,,,,,,,,,,,, ,,,,,,,,,,,,pas-id-2892B1D448BC91DD,,"

    
${WordFind"$1" "," "+1{" $Firstname
    
${WordFind"$Firstname" "," "-1}" $Firstname

    
${WordFind"$1" "," "+2{" $Lastname
    
${WordFind"$Lastname" "," "-1}" $Lastname

    
${WordFind"$1" "," "+4{" $Workphone
    
${WordFind"$Workphone" "," "-1}" $Workphone

    
${WordFind"$1" "," "+9{" $Phone
    
${WordFind"$Phone" "," "-1}" $Phone

    
${WordFind"$1" "," "+12{" $Mobile
    
${WordFind"$Mobile" "," "-1}" $Mobile

    MessageBox MB_OK 
"$Firstname|$Lastname|$Workphone|$Phone|$Mobile"
SectionEnd 
Instructor is offline   Reply With Quote
Old 27th April 2010, 08:38   #3
xbarns
Senior Member
 
xbarns's Avatar
 
Join Date: Aug 2007
Location: Frankfurt, Germany
Posts: 187
Thumbs up

Thanks a lot, i even think i understand how it works (but please don't ask me to explain)
xbarns 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