Jump to content

Very odd behaviour for ListView control


Recommended Posts

When an item is selected that as a certen value eg. 14, the Button variable that has that value is called

ListView:

;// List Box //
$listBox = GUICtrlCreateListView("Item1|Item2|Item3",  112, 24, 610, 350)
GUICtrlRegisterListViewSort(-1, "LVSort2"); Register the function "SortLV" for the sorting callback

Button:

Case $msg = $mnuClose;// Close Form Requested
#cs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
    This is a Bug I Can't Fix
    If ListBox has a selection value of 14 then [Close] is called
    $mnuClose - has a value of 14 ???
#ce ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
If GUICtrlRead($listBox) = 14 Then ContinueCase
ExitLoop

This isn't the only control ...

Case $msg = $cmdEdit;// Edit Selection

I can tell you has a value of 17, because when the 17th item in the list is selected - [$cmdEdit] is called !!!

Can anybody help?

=|)arkSprout=

=|)arkSprout=VBA | VBScript | C# Programmer [font="Verdana"]"Give a person a fish and you feed them for a day; teach a person to use the Internet and they won't bother you for weeks."[/font]
Link to comment
Share on other sites

Can you post a full script that reproduces the problem?

That way we don't have to spend time (re)building one ourselves, and can see all things you've done that might be pertinent.

Link to comment
Share on other sites

Does the word Continue suggest anything to you?

If GUICtrlRead($listBox) = 14 Then ContinueCase
ExitLoop

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

Does the word Continue suggest anything to you?

If GUICtrlRead($listBox) = 14 Then ContinueCase
ExitLoop
I added the ContinueCase after the issue arose, to roll over this problem, the form closing. Edited by DarkSprout
=|)arkSprout=VBA | VBScript | C# Programmer [font="Verdana"]"Give a person a fish and you feed them for a day; teach a person to use the Internet and they won't bother you for weeks."[/font]
Link to comment
Share on other sites

OK, here is the code (it's a biggen) - If you don't have Spotify installed it will throw errors about opening links..

;// #jotify.au3#~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
;//  Author   : =|)arkSprout= [June09]
;//  Purpose  : Spotify Playlist/Album Manager
;//  Local Functions:=
;//          ReadTextFile()
;//          AddToListBox($f_Artist = "", $f_Album = "", $f_Link = "", $f_Tag = "", $f_index = -1)
;//          RebuildList($listBox, $cboTags, $tagFilter)
;//          SaveFile()
;//          Trim($strIn)
;//          ShortSpotifyURI($strIn
;//          HTTPSpotifyLink($strIn)
;//  Not My Functions:=
;//          MyGUICtrlCreateListViewItem($sText, $nCtrlID, $nIndex)
;//          GetSubItemText($nCtrlID, $nItemID, $nColumn)
;//          LVSort2($hWnd, $nItem1, $nItem2, $nColumn)
;// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <ListViewConstants.au3>
#include <EditConstants.au3>
#include <StaticConstants.au3>
#include <GUIListBox.au3>
#include <ComboConstants.au3>
#include <GUIListView.au3>
#include <WindowsConstants.au3>
#include <Array.au3>
;#include <Debug.au3>
;_DebugSetup ( "debug_jotify" )

;#AutoIt3Wrapper_icon=jotify.ico

Global $artistArray[1]
Global $albumArray[1]
Global $linksArray[1]
Global $tagsArray[1]
Global $arraySearchIndex
Global $file

;// List Box Globals //
Global $nCurCol = -1
Global $nSortDir = 1
Global $bSet = 0
Global $nCol = -1

_Main()
;==>ExitScrpt
        
Func _Main()
Local $returnAdd, $strOut, $arraySize, $strCombo
$nCurCol = -1
$nSortDir = 1
$bSet = 0
$nCol = -1
    
    #Region ### START Koda GUI section ### Form=
;// Form //
        $frm_jotify = GUICreate("jotify", 740, 445, 192, 124, BitOR($WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS))
        
;// Menu //
        $masterMenu = GUICtrlCreateMenu("Ac&tions")
        $mnuImportLinkList = GUICtrlCreateMenuItem("* Import &Link List", $masterMenu)
        $mnuSeparator1 = GUICtrlCreateMenuItem("", $masterMenu)
        $mnuSortItems = GUICtrlCreateMenu("So&rt", $masterMenu)
            $submnuSortArtist = GUICtrlCreateMenuItem("* Sort by &Artist", $mnuSortItems)
            $submnuSortAlbum = GUICtrlCreateMenuItem("* Sort by Al&bum", $mnuSortItems)
            $submnuSortTags = GUICtrlCreateMenuItem("* Sort by &Tags", $mnuSortItems)
        
        $mnuSeparator2 = GUICtrlCreateMenuItem("", $masterMenu)
        $mnuClipHTTP_Link = GUICtrlCreateMenuItem("Copy Spotify UR&L To Clipboard", $masterMenu)
        $mnuClipSpotyLink = GUICtrlCreateMenuItem("Copy Spotify UR&I To Clipboard", $masterMenu)
        $mnuSeparator3 = GUICtrlCreateMenuItem("", $masterMenu)
        $mnuClose = GUICtrlCreateMenuItem("&Close", $masterMenu)

;// List Box //
        $listBox = GUICtrlCreateListView("Artist|Album|Spotify Link",  112, 24, 610, 350)
        GUICtrlRegisterListViewSort(-1, "LVSort2"); Register the function "SortLV" for the sorting callback

;// Combo Box //
        $cboTags = GUICtrlCreateCombo("", 112,389, 225, 25)
        GUICtrlSetFont(-1, 10, 800, 0, "Arial")

;// Buttons //
        $cmdOpen = GUICtrlCreateButton("&Open Link", 16, 32, 81, 41, $BS_DEFPUSHBUTTON)
        GUICtrlSetFont(-1, 10, 800, 0, "Arial")
        $cmdEdit = GUICtrlCreateButton("&Edit", 16, 88, 81, 41, 0)
        GUICtrlSetFont(-1, 10, 800, 0, "Arial")
        $cmdAdd = GUICtrlCreateButton("&Add", 16, 144, 81, 41, 0)
        GUICtrlSetFont(-1, 10, 800, 0, "Arial")
        $cmdDelete = GUICtrlCreateButton("&Delete", 16, 200, 81, 41, 0)
        GUICtrlSetFont(-1, 10, 800, 0, "Arial")
        GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

;// Load in text file //
    ReadTextFile()
    
;// Fill list box //
    For $x = 1 to UBound($artistArray) -1
        MyGUICtrlCreateListViewItem( $artistArray[$x] & "|" & $albumArray[$x] & "|" & $linksArray[$x], $listBox, -1)
    Next
    
;// Fill ComboBox //
    GUICtrlSetData($cboTags, "All" & BuildTagList($tagsArray), "All") 

;// Main Loop | Wait for button press //
Do 
    $msg = GUIGetMsg()
;If $msg <> 0 Then _DebugOut($nMsg,1);\\ Track Button Presses
    Select
        Case $msg = $cboTags;// Filter listBox based on Tag in ComboBox
            RebuildList($listBox, $cboTags, GUICtrlRead($cboTags))
        
        Case $msg = $cmdOpen
            $arraySearchIndex = _ArraySearch($linksArray, GetSubItemText($listBox,GUICtrlRead($listBox),2))
            If $arraySearchIndex > 0 Then
                ShellExecute("spotify:" & $linksArray[$arraySearchIndex])
            EndIf
            
        Case $msg = $cmdEdit;// Edit Selection
            $arraySearchIndex = _ArraySearch($linksArray, GetSubItemText($listBox,GUICtrlRead($listBox),2))
            If $arraySearchIndex > 0 Then
                $returnAdd = AddToListBox($artistArray[$arraySearchIndex],$albumArray[$arraySearchIndex], _
                    $linksArray[$arraySearchIndex], $tagsArray[$arraySearchIndex], $arraySearchIndex)
                If $returnAdd <> "" Then
                    GUICtrlSetData($listBox, $returnAdd)
                    RebuildList($listBox, $cboTags, "All")
                EndIf
            EndIf               
                
        Case $msg = $cmdAdd;// Add to list box
            If AddToListBox() = True Then 
                RebuildList($listBox, $cboTags, "All")
            EndIf
            
        Case $msg = $cmdDelete;// Delete Selection
            $arraySearchIndex = _ArraySearch($linksArray, GetSubItemText($listBox,GUICtrlRead($listBox),2))
            If $arraySearchIndex > 0 Then
                If MsgBox(292, "jotify ~ Question", "Are you sure you wish to delete:" & @CRLF & @CRLF & _
                        $artistArray[$arraySearchIndex] & " - " & $albumArray[$arraySearchIndex] & "?") = 6 Then
                    _ArrayDelete($artistArray,$arraySearchIndex)
                    _ArrayDelete($albumArray,$arraySearchIndex)
                    _ArrayDelete($linksArray,$arraySearchIndex)
                    _ArrayDelete($tagsArray, $arraySearchIndex)
                    RebuildList($listBox, $cboTags, "All")
                EndIf
            EndIf
        Case $msg = $listBox
            ContinueCase

;// Menu //
        Case $msg = $mnuClipHTTP_Link;// Copy HTTTP (hyperlink) version of Spotify Link to the Clipboard
            $arraySearchIndex = _ArraySearch($linksArray, GetSubItemText($listBox,GUICtrlRead($listBox),2))
            If $arraySearchIndex > 0 Then
                ClipPut(HTTPSpotifyLink($linksArray[$arraySearchIndex]))
            EndIf
            
        Case $msg = $mnuClipSpotyLink;// Copy Spotify Link {URI) to the Clipboard
            $arraySearchIndex = _ArraySearch($linksArray, GetSubItemText($listBox,GUICtrlRead($listBox),2))
            If $arraySearchIndex > 0 Then
                ClipPut("Spotify:" & ShortSpotifyURI($linksArray[$arraySearchIndex]))
            EndIf
            
        Case $msg = $mnuClose;// Close Form Requested
            #cs ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
                This is a Bug I Can't Fix
                If ListBox has a selection value of 14 then [Close] is called
                $mnuClose - has a value of 14 ???
            #ce ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ #
            If GUICtrlRead($listBox) = 14 Then ContinueCase
            ExitLoop
    EndSelect
Until $msg = $GUI_EVENT_CLOSE

GUIDelete()
SaveFile();// Save Arrays
EndFunc;==>_Main

Func ReadTextFile()
Dim $file
Dim $iMsgBoxAnswer
Dim $loopCount = 1
Dim $splitArray[4]
    
    If Not FileExists("jotify_database.jtb") Then
;// File Missing | Create New? //
        $iMsgBoxAnswer = MsgBox(292, "jotify ~ Question","Database File Not Found!" & @CRLF & @CRLF & "Do you wish to create a new one?")
        Select
           Case $iMsgBoxAnswer = 6;// Yes
                $file = FileOpen("jotify_database.jtb", 10);// Create [jotify_database.jtb]
           Case Else
                Exit
        EndSelect
        
    Else
;// File Exists //
        $file = FileOpen("jotify_database.jtb", 0)

        While 1
            $line = FileReadLine($file)
            If @error = -1 Then ExitLoop
            $splitArray = StringSplit($line,"|")
            
    ;// Add to arrays //
            _ArrayAdd($artistArray,Trim($splitArray[1]))
            _ArrayAdd($albumArray, Trim($splitArray[2]))
            _ArrayAdd($linksArray, Trim($splitArray[3]))
            _ArrayAdd($tagsArray, Trim($splitArray[4]))
        Wend

        FileClose($file)
    EndIf

EndFunc;==>ReadTextFile

Func AddToListBox($f_Artist = "", $f_Album = "", $f_Link = "", $f_Tag = "", $f_index = -1)
Dim $blComplete
Dim $artist
Dim $album
Dim $link
Dim $tag

$blComplete = False

#Region ### START Koda GUI section ### Form=
    $frmInput = GUICreate("Spotify Data Input", 435, 210, 286, 224, BitOR($WS_EX_TOPMOST,$WS_CAPTION,$WS_POPUP,$WS_BORDER,$WS_CLIPSIBLINGS))
    $artistInput = GUICtrlCreateInput($f_Artist, 157, 32, 250, 26)
    GUICtrlSetFont(-1, 12, 400, 0, "Arial")
    $Label1 = GUICtrlCreateLabel("Artist", 37, 32, 44, 23)
    GUICtrlSetFont(-1, 12, 800, 0, "Arial")
    GUICtrlSetColor(-1, 0x008000)
    $InputAlbum = GUICtrlCreateInput($f_Album, 157, 65, 250, 26)
    GUICtrlSetFont(-1, 12, 400, 0, "Arial")
    $Label2 = GUICtrlCreateLabel("Album", 37, 65, 53, 23)
    GUICtrlSetFont(-1, 12, 800, 0, "Arial")
    GUICtrlSetColor(-1, 0x008000)
    $inputLink = GUICtrlCreateInput($f_Link, 157, 98, 250, 26)
    GUICtrlSetFont(-1, 12, 400, 0, "Arial")
    $Label3 = GUICtrlCreateLabel("Spotify Link", 35, 98, 95, 23)
    GUICtrlSetFont(-1, 12, 800, 0, "Arial")
    GUICtrlSetColor(-1, 0x008000)
    $inputTags = GUICtrlCreateInput($f_Tag, 157, 131, 250, 26)
    GUICtrlSetFont(-1, 12, 400, 0, "Arial")
    GUICtrlSetTip(-1,'Seperate by commas for mutible tags ~ e.g. Dance, 1980s, Electro')
    $Label4 = GUICtrlCreateLabel("Tag", 35, 131, 95, 23)
    GUICtrlSetFont(-1, 12, 800, 0, "Arial")
    GUICtrlSetColor(-1, 0x008000)
    $cmdCancel = GUICtrlCreateButton("&Cancel", 101, 164, 97, 33, $BS_DEFPUSHBUTTON )
    GUICtrlSetFont(-1, 10, 800, 0, "Arial")
    $cmdDone = GUICtrlCreateButton("&Done", 245, 164, 97, 33, 0)
    GUICtrlSetFont(-1, 10, 800, 0, "Arial")
    GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsgInput = GUIGetMsg()
    Switch $nMsgInput
        Case $cmdCancel
            $blComplete = False
            ExitLoop
        Case $cmdDone
            $blComplete = True
            ExitLoop
        Case $inputLink
            GUICtrlSetData($inputLink, ShortSpotifyURI(GUICtrlRead($inputLink)))
    EndSwitch
WEnd

;// Store values before form closes //
$artist = GUICtrlRead($artistInput)
$album = GUICtrlRead($InputAlbum)
$link = GUICtrlRead($inputLink)
$tag = GUICtrlRead($inputTags)

;// Close Form //
GUIDelete()

;// Return value | insert into array //
If $blComplete = True Then
    If $f_index = -1 Then
        _ArrayAdd($artistArray, $artist);// Add
        _ArrayAdd($albumArray, $album)
        _ArrayAdd($linksArray, $link)
        _ArrayAdd($tagsArray, $tag)
    Else
        $artistArray[$f_index] = $artist;// Insert
        $albumArray[$f_index] = $album
        $linksArray[$f_index] = $link
        $tagsArray[$f_index] = $tag
    EndIf
EndIf

Return $blComplete
EndFunc;==>AddToListBox

;// Delete and rebuild listbox with selected items //
Func RebuildList($listBox, $cboTags, $tagFilter)
Dim $strCombo

    GUICtrlDelete($listBox)
    GUICtrlDelete($cboTags)

;// Make List Box //
    $listBox = GUICtrlCreateListView("Artist|Album|Spotify Link",  112, 24, 610, 350, -1)
    GUICtrlRegisterListViewSort(-1, "LVSort2");// Register the function "SortLV" for the sorting callback
    
;// Fill List Box | filtered by Tag //
    For $x = 1 to UBound($artistArray) -1
        If $tagFilter = "All" Or StringInStr($tagsArray[$x], $tagFilter, 0) > 0 Then
            MyGUICtrlCreateListViewItem( $artistArray[$x] & "|" & $albumArray[$x] & "|" & $linksArray[$x], $listBox, -1)
        EndIf
    Next

;// Combo Box //
    $cboTags = GUICtrlCreateCombo("", 112,389, 225, 25)
    GUICtrlSetFont(-1, 10, 800, 0, "Arial")
    GUICtrlSetData(-1, "All" & BuildTagList($tagsArray), $tagFilter)
EndFunc;==>RebuildList

;// Write back array contents //
Func SaveFile()
Dim $x
    $file = FileOpen("jotify_database.jtb", 10);// Overwrite [jotify_database.jtb]
    
    For $x = 1 to UBound($artistArray)-1
        If StringLen(Trim($artistArray[$x])) > 0 Then
            FileWriteLine($file, $artistArray[$x] & "|" & $albumArray[$x] & "|" & $linksArray[$x] & "|" & $tagsArray[$x] & @CRLF)
        EndIf
    Next
    FileClose($file)

EndFunc;==>SaveFile

;// Build Unique List of all Tags | Buggy as hell not sorting Unique yet! //
Func BuildTagList($arrayIn)
Dim $returnString
$tagsUniqueArray = _ArrayUnique($arrayIn)

For $x = 1 To UBound($tagsUniqueArray) - 1
    $splitArray = StringSplit($tagsUniqueArray[$x],",")
    For $y = 1 To UBound($splitArray) - 1
        $returnString = $returnString & Trim($splitArray[$y]) & "|"
    Next
Next

Return $returnString
EndFunc;==>BuildTagList

;// Strip Leading and Trailing White Space //
Func Trim($strIn)
    return StringStripWS(StringStripWS($strIn, 1), 2)
EndFunc;==>Trim

Func ShortSpotifyURI($strIn)
;// Shorten URI //
    $strIn = StringReplace($strIn,"http://open.spotify.com/","")
    $strIn = StringReplace($strIn,"/",":")
    $strIn = StringReplace($strIn,"spotify:","")
    Return $strIn
EndFunc;==>ShortSpotifyURI

Func HTTPSpotifyLink($strIn)
;// Create HTTP hyperlink //
    $strIn = StringReplace($strIn,"http://open.spotify.com/","")
    $strIn = StringReplace($strIn,"spotify:","")
    $strIn = StringReplace($strIn,":","/")
    $strIn = "http://open.spotify.com/" & $strIn
    Return $strIn
EndFunc;==>HTTPSpotifyLink

;// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ GUI CONTROLS ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //
;// Create and insert items directly into the listview //
Func MyGUICtrlCreateListViewItem($sText, $nCtrlID, $nIndex)
    Local $stLvItem = DllStructCreate("uint;int;int;uint;uint;ptr;int;int;int;int;")
    Local $stText = DllStructCreate("char[260]")
    Local $arText = StringSplit($sText, "|")
    
    If $nIndex = -1 Then $nIndex = GUICtrlSendMsg($nCtrlID, $LVM_GETITEMCOUNT, 0, 0)
    
    DllStructSetData($stText, 1, $arText[1]);// Save the item text in the struct
    
    DllStructSetData($stLvItem, 1, BitOR($LVIF_TEXT, $LVIF_PARAM))
    DllStructSetData($stLvItem, 2, $nIndex)
    DllStructSetData($stLvItem, 6, DllStructGetPtr($stText))
;// Set the lParam of the struct to the line index - unique within the listview //
    DllStructSetData($stLvItem, 9, $nIndex)
    
    $nIndex = GUICtrlSendMsg($nCtrlID, $LVM_INSERTITEMA, 0, DllStructGetPtr($stLvItem))

    If $nIndex > -1 Then
;// Insert now the rest of the column text //
        For $i = 2 To $arText[0]
            DllStructSetData($stText, 1, $arText[$i])
            DllStructSetData($stLvItem, 3, $i - 1);// Store the subitem index
            
            GUICtrlSendMsg($nCtrlID, $LVM_SETITEMTEXTA, $nIndex, DllStructGetPtr($stLvItem))
        Next
    EndIf

    $stText = 0
    $stLvItem = 0

;// Change the column width to fit the item text //
    For $i = 0 To 2
        GUICtrlSendMsg($nCtrlID, $LVM_SETCOLUMNWIDTH, $i, -1)
        GUICtrlSendMsg($nCtrlID, $LVM_SETCOLUMNWIDTH, $i, -2)
    Next
EndFunc ;==>MyGUICtrlCreateListViewItem

;// Retrieve the text of a listview item in a specified column //
Func GetSubItemText($nCtrlID, $nItemID, $nColumn)
    Local $stLvfi = DllStructCreate("uint;ptr;int;int[2];int")
    Local $nIndex, $stBuffer, $stLvi, $sItemText
    
    DllStructSetData($stLvfi, 1, $LVFI_PARAM)
    DllStructSetData($stLvfi, 3, $nItemID)

    $stBuffer = DllStructCreate("char[260]")
    
    $nIndex = GUICtrlSendMsg($nCtrlID, $LVM_FINDITEM, -1, DllStructGetPtr($stLvfi));
    
    $stLvi = DllStructCreate("uint;int;int;uint;uint;ptr;int;int;int;int")
    
    DllStructSetData($stLvi, 1, $LVIF_TEXT)
    DllStructSetData($stLvi, 2, $nIndex)
    DllStructSetData($stLvi, 3, $nColumn)
    DllStructSetData($stLvi, 6, DllStructGetPtr($stBuffer))
    DllStructSetData($stLvi, 7, 260)

    GUICtrlSendMsg($nCtrlID, $LVM_GETITEMA, 0, DllStructGetPtr($stLvi));

    $sItemText = DllStructGetData($stBuffer, 1)

    $stLvi = 0
    $stLvfi = 0
    $stBuffer = 0
    
    Return $sItemText
EndFunc ;==>GetSubItemText

;// Our sorting callback funtion //
Func LVSort2($hWnd, $nItem1, $nItem2, $nColumn)
    Local $nSort, $val1, $val2, $nResult
    
;// Switch the sorting direction //
    If $nColumn = $nCurCol Then
        If Not $bSet Then
            $nSortDir = $nSortDir * - 1
            $bSet = 1
        EndIf
    Else
        $nSortDir = 1
    EndIf
    $nCol = $nColumn
    
    $val1 = GetSubItemText($hWnd, $nItem1, $nColumn)
    $val2 = GetSubItemText($hWnd, $nItem2, $nColumn)

;// If it is the 3rd colum (column starts with 0) then compare the dates //
    If $nColumn = 2 Then
        $val1 = StringRight($val1, 4) & StringMid($val1, 4, 2) & StringLeft($val1, 2)
        $val2 = StringRight($val2, 4) & StringMid($val2, 4, 2) & StringLeft($val2, 2)
    EndIf
    
    $nResult = 0;// No change of item1 and item2 positions
    
    If $val1 < $val2 Then
        $nResult = -1;// Put item2 before item1
    ElseIf $val1 > $val2 Then
        $nResult = 1;// Put item2 behind item1
    EndIf

    $nResult = $nResult * $nSortDir
    
    Return $nResult
EndFunc ;==>LVSort2

You will also need the raw data: make a text file (or it will, when run) called [jotify_database.jtb] - and place this data into it

Evanescence|Falen|album:3nP4aieZst8gWhl1HY6vQZ|Rock
Mummers, The|Tale To Tell|album:35UhMrHnSZW3lsSoCMlNfk|Dance
Queeen|A Kind Of Magic|album:4QBs65mzNnBxpXMVxSjo3k|Rock
Empire Of The Sun|Walking On A Dream|album:3D816SIDgxP2TVVpdEuCqQ|Indi, 2009, Dance
Röyksopp|Junior|album:5aT9snahZn7UcoKVF6H6rj|Electro, Pop
A Camp|Calonia|album:367E5vR9s8asvh0Ma5tywr|Indi
Connor Oberst|Outer South|album:7ofnPJTtkpLAJEETBUwG1Y|Indi
Sonny J|Disastro|album:35cprvxCOpaCZOxuqq8Ucv|Dance
Darren's Playlist|Misc|user:dbartrup:playlist:1J3uj74M5QGmnpSv7dU3S5|Playlist
djbaku|Random Coolness|user:djbaku:playlist:50dSvXTupgdfXZUeHyU9K0|Playlist
kevinjump|Bad Queen|user:kevinjump:playlist:5wP60lCbLIzlHUTgjqHYEa|Playlist
locksteel|An eclectic playlist of 1980s killers!|user:locksteel:playlist:3zdf8i2VUDDr8tDh7HI0rh|Playlist
afront - playlist|Afront’s Synthpop 2009|user:afront:playlist:0pnHi33ahqngqq64Oq7e1e|Playlist
Animal Collective|Merriweather Post Pavilion|album:3Ew40olMfd5X4BvqfuFoqF|Dance, 2009
Imelda May|Love Tatto|album:5simO13J9br1uiBrLVpnPX|Swing
St. Vincent|Actor|album:6RdfrSuuoZBUcvVHlWW2Wd|Alt.
Green Day|Dookie|album:4uG8q3GPuWHQlRbswMIRS6|Punk
Black Eyed Peas|Comp|user:dsdrury:playlist:6SMm7jsynfXnX8DGwClyGE|Playlist
Cross|Shove It|album:4hiaa7Hh0yS3W2rrKl7i5z|Rock

Please Click all items in list to see the error,

Thanks,

Edited by DarkSprout
=|)arkSprout=VBA | VBScript | C# Programmer [font="Verdana"]"Give a person a fish and you feed them for a day; teach a person to use the Internet and they won't bother you for weeks."[/font]
Link to comment
Share on other sites

The following comment is incorrect about the code, the code is where your problem is:

;// Set the lParam of the struct to the line index - unique within the listview //
    DllStructSetData($stLvItem, 9, $nIndex)

SciTE for AutoItDirections for Submitting Standard UDFs

 

Don't argue with an idiot; people watching may not be able to tell the difference.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...