Page 1 of 2 12 LastLast
Results 1 to 10 of 15

Thread: Custom List manager

  1. #1
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,867

    Custom List manager

    I try to create a function in vb6 that modify a line of my custom list but the first line isn't delete !
    my list format :
    Code:
    LST081337||Festnetz
    ICO$SKINPATH$include\contacts\userpics\Kai.jpg
    LST+4915153||CarHandy
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST74123||Torsten
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST64123||Peter
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST64189||Heidi
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST147258||Petra
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST55555||Anne
    ICO$SKINPATH$include\Contacts\userpics\Anne.Jpg
    LST789||Mandy
    ICO$SKINPATH$include\Contacts\userpics\Mandy.Jpg
    LST963||Lisa
    ICO$SKINPATH$include\Contacts\userpics\Lisa.Jpg
    LST0815||Hampelmann
    ICO$SKINPATH$include\Contacts\userpics\Peter.Jpg
    my function in vb6:
    Code:
    Public Sub ModifyCustomList(ByVal CustomList As String, ByVal StringToMofify As String, ByVal CLText As String, CLDescription As String, CLImg As String)
        Dim strPath() As String
        Dim lngIndex As Long
        strPath() = Split(CLImg, "\")
        lngIndex = UBound(strPath)
        CLImg = "$SKINPATH$include\Contacts\userpics\" & strPath(lngIndex)
        
        Const ForReading = 1: Const ForWriting = 2
        Dim objFSO, objFile, allLines, arrLines, x
        GiveLineNumberForString CustomList, StringToMofify
        'RRSDK.SetUserVar "StringToMofify", StringToMofify & " --> " & ReturnedLineNumberForString
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objFile = objFSO.OpenTextFile(CustomList, ForReading, True, -1)
        allLines = objFile.ReadAll
        arrLines = Split(allLines, vbCrLf)
        arrLines(ReturnedLineNumberForString) = "LST" & CLText & "||" & CLDescription & vbCrLf
        arrLines(ReturnedLineNumberForString + 1) = "ICO" & CLImg & vbCrLf
        objFile.Close
        Set objFSO = CreateObject("Scripting.FileSystemObject")
        Set objFile = objFSO.OpenTextFile(CustomList, ForWriting, True, -1)
        For x = 1 To UBound(arrLines)
            If x = ReturnedLineNumberForString Then
                objFile.Write (arrLines(ReturnedLineNumberForString))
            End If
            If x = ReturnedLineNumberForString + 1 Then
                objFile.Write (arrLines(ReturnedLineNumberForString + 1))
            End If
            If x < ReturnedLineNumberForString Or x > ReturnedLineNumberForString + 1 Then
                objFile.Write (arrLines(x) & vbCrLf)
            End If
        Next
        objFile.Close
    
    End Sub
    
    Public Sub GiveLineNumberForString(ByVal FileName As String, ByVal strToSearch As String) 'As Integer
        Dim strTextLine As String
        Dim l As Long
        'ReturnedLineNumberForString = 0
        
        Open FileName For Input As #1
        Do While Not EOF(1)
           l = l + 1
           Line Input #1, strTextLine
           If InStr(strTextLine, strToSearch) Then
               'MsgBox strToSearch & " is on line " & l
               ReturnedLineNumberForString = l
           End If
        Loop
        'Return
        Close #1
    End Sub
    I use this command like that:
    Code:
        'ibuscommunicatorrext;modifycontact;$SKINPATH$phone_list.txt;$NEWNUMBER$|$NEWNAME$|$NEWIMG$
        If LCase(Left$(CMD, 32)) = "ibuscommunicatorr;modifycontact;" Then
            IconPath = Split(dt(3), "|")
            ToLog ("The contact " & RRSDK.GetUserVar("MODNAME") & " is modified")
            ToLog ("New number " & IconPath(0))
            ToLog ("New name " & IconPath(1))
            ToLog ("New icon " & IconPath(2))
            ModifyCustomList dt(2), RRSDK.GetUserVar("MODNAME"), IconPath(0), IconPath(1), IconPath(2) 'Number,Name,Icon
            ProcessCommand = 2
        End If
    Thanks for your help

  2. #2
    Mo' Programming Mo' Problems
    Auto Apps:loading...
    Sonicxtacy02's Avatar
    Join Date
    Sep 2004
    Location
    Woodbridge, VA
    Posts
    8,169
    Blog Entries
    53
    just add a "0" to the first line of the list. The first line I believe is supposed to show the number of items in the list.
    mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
    Find my plugins on the MP3Car App Store!
    Follow Me on Twitter or Facebook
    Live mp3Car Facebook Chat

  3. #3
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,867
    Why add a 0 if i use the clload with the TRUE option ?

  4. #4
    Mo' Programming Mo' Problems
    Auto Apps:loading...
    Sonicxtacy02's Avatar
    Join Date
    Sep 2004
    Location
    Woodbridge, VA
    Posts
    8,169
    Blog Entries
    53
    Quote Originally Posted by pierrotm777 View Post
    Why add a 0 if i use the clload with the TRUE option ?
    I have no idea how its coded in the core, but in looking at your .txt file, its not plain text. You have lines that RR has to parse, a plain text file would have no LST ICO delimiters associated with it.

    If you're building your text file in your plugin there's no reason to try to build it as plain text, RR still has to do the work to format it based on your delimiter values.
    mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
    Find my plugins on the MP3Car App Store!
    Follow Me on Twitter or Facebook
    Live mp3Car Facebook Chat

  5. #5
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,867
    I use this format because the RR user that ask me to create this manager for him want a minimum into the plugin , just add , delete and modify custom list functions !
    It's why i use this format that RR know directly !

  6. #6
    Mo' Programming Mo' Problems
    Auto Apps:loading...
    Sonicxtacy02's Avatar
    Join Date
    Sep 2004
    Location
    Woodbridge, VA
    Posts
    8,169
    Blog Entries
    53
    Quote Originally Posted by pierrotm777 View Post
    I use this format because the RR user that ask me to create this manager for him want a minimum into the plugin , just add , delete and modify custom list functions !
    It's why i use this format that RR know directly !
    So you're not creating the list, you're simply adding/removing/modifying an item in the list? Whatever plugin or program that's creating the list simply needs to place a "0" placeholder in the top line of the text file. Then your code above works just fine.
    Last edited by Sonicxtacy02; 05-23-2013 at 11:13 AM.
    mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
    Find my plugins on the MP3Car App Store!
    Follow Me on Twitter or Facebook
    Live mp3Car Facebook Chat

  7. #7
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,867
    I suppose that the line objFile.Write("0") add a 0 on the first line but i don't understand the need of this 0.

  8. #8
    Mo' Programming Mo' Problems
    Auto Apps:loading...
    Sonicxtacy02's Avatar
    Join Date
    Sep 2004
    Location
    Woodbridge, VA
    Posts
    8,169
    Blog Entries
    53
    Quote Originally Posted by pierrotm777 View Post
    I suppose that the line objFile.Write("0") add a 0 on the first line but i don't understand the need of this 0.
    The 0 is technically supposed to contain the number of items in the list. Its my assumption that it was added to the Custom List code for future-proofing or something, but it doesn't really have any value that I know of. The bottom line is CLLOAD expects the list items to begin on line 2 of the text file. That's the way the file is parsed.
    mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
    Find my plugins on the MP3Car App Store!
    Follow Me on Twitter or Facebook
    Live mp3Car Facebook Chat

  9. #9
    Raw Wave pierrotm777's Avatar
    Join Date
    May 2008
    Location
    Bordeaux, France
    Posts
    2,867
    I obtain exactly the same issue:
    Original list:
    Code:
    0
    LST081337||Festnetz
    ICO$SKINPATH$include\contacts\userpics\Kai.jpg
    LST+4915153||CarHandy
    ICO$SKINPATH$include\contacts\userpics\CarHandy.jpg
    LST74123||Torsten
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST64123||Peter
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST64189||Heidi
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST147258||Petra
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST55555||Anne
    ICO$SKINPATH$include\Contacts\userpics\Anne.Jpg
    LST789||Mandy
    ICO$SKINPATH$include\Contacts\userpics\Mandy.Jpg
    LST963||Lisa
    ICO$SKINPATH$include\Contacts\userpics\Lisa.Jpg
    LST0815||Hampelmann
    ICO$SKINPATH$include\Contacts\userpics\Peter.Jpg
    List modified:
    Code:
    0
    LST081337||Festnetz
    ICO$SKINPATH$include\contacts\userpics\Kai.jpg
    LST+4915153||CarHandy
    ICO$SKINPATH$include\contacts\userpics\CarHandy.jpg
    LST+4915153||Carton
    ICO$SKINPATH$include\Contacts\userpics\CarHandy.jpg
    LST64123||Peter
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST64189||Heidi
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST147258||Petra
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST55555||Anne
    ICO$SKINPATH$include\Contacts\userpics\Anne.Jpg
    LST789||Mandy
    ICO$SKINPATH$include\Contacts\userpics\Mandy.Jpg
    LST963||Lisa
    ICO$SKINPATH$include\Contacts\userpics\Lisa.Jpg
    LST0815||Hampelmann
    ICO$SKINPATH$include\Contacts\userpics\Peter.Jpg
    As you can to see, the blue lines aren't replaced by the red lines !
    This are the green lines that are replaced !

  10. #10
    Mo' Programming Mo' Problems
    Auto Apps:loading...
    Sonicxtacy02's Avatar
    Join Date
    Sep 2004
    Location
    Woodbridge, VA
    Posts
    8,169
    Blog Entries
    53
    Quote Originally Posted by pierrotm777 View Post
    I obtain exactly the same issue:
    Original list:
    Code:
    0
    LST081337||Festnetz
    ICO$SKINPATH$include\contacts\userpics\Kai.jpg
    LST+4915153||CarHandy
    ICO$SKINPATH$include\contacts\userpics\CarHandy.jpg
    LST74123||Torsten
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST64123||Peter
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST64189||Heidi
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST147258||Petra
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST55555||Anne
    ICO$SKINPATH$include\Contacts\userpics\Anne.Jpg
    LST789||Mandy
    ICO$SKINPATH$include\Contacts\userpics\Mandy.Jpg
    LST963||Lisa
    ICO$SKINPATH$include\Contacts\userpics\Lisa.Jpg
    LST0815||Hampelmann
    ICO$SKINPATH$include\Contacts\userpics\Peter.Jpg
    List modified:
    Code:
    0
    LST081337||Festnetz
    ICO$SKINPATH$include\contacts\userpics\Kai.jpg
    LST+4915153||CarHandy
    ICO$SKINPATH$include\contacts\userpics\CarHandy.jpg
    LST+4915153||Carton
    ICO$SKINPATH$include\Contacts\userpics\CarHandy.jpg
    LST64123||Peter
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST64189||Heidi
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST147258||Petra
    ICO$SKINPATH$include\contacts\userpics\0_default.png
    LST55555||Anne
    ICO$SKINPATH$include\Contacts\userpics\Anne.Jpg
    LST789||Mandy
    ICO$SKINPATH$include\Contacts\userpics\Mandy.Jpg
    LST963||Lisa
    ICO$SKINPATH$include\Contacts\userpics\Lisa.Jpg
    LST0815||Hampelmann
    ICO$SKINPATH$include\Contacts\userpics\Peter.Jpg
    As you can to see, the blue lines aren't replaced by the red lines !
    This are the green lines that are replaced !
    did you modify your command so that everything shifts to compensate for the new line? you have to factor out line 1 when building your array
    mp3Car.com Senior Tech Blogger (Want a product reviewed? Contact me.)
    Find my plugins on the MP3Car App Store!
    Follow Me on Twitter or Facebook
    Live mp3Car Facebook Chat

Page 1 of 2 12 LastLast

Similar Threads

  1. Need little help with custom list with C#
    By pierrotm777 in forum Road Runner
    Replies: 7
    Last Post: 06-28-2012, 11:04 AM
  2. Custom List with Variables
    By MGD in forum Road Runner
    Replies: 8
    Last Post: 03-17-2012, 03:40 PM
  3. Custom List question??
    By eribs4e in forum RR Skins
    Replies: 2
    Last Post: 08-11-2009, 10:12 AM
  4. Custom List creation
    By lambosprit in forum Road Runner
    Replies: 11
    Last Post: 05-12-2009, 08:46 PM
  5. Custom List (SC)
    By EL CAMINO in forum Road Runner
    Replies: 2
    Last Post: 10-29-2007, 01:41 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •