#include #include Dim $SItemsOld = 0, $QItemsOld = 0 ;Variables to note changes Dim $SPointer = 0;, $SLimiter = 11 ;Variables for the pointer Global Const $WM_COMMAND = 0x0111, $BM_CLICK = 0x00F5 ;Constant Commands Opt ("WinTitleMatchMode", 4) ;Sets the mode to 'classname=*' titlematch ;Check if Winamp is Running, otherwise exit: If WinExists("classname=Winamp v1.x")=0 Then MsgBox(0, "Error:", "Winamp MUST be on!") Exit EndIf ;Get the main handles: Winamp & Jump-to-File $WAhandle = ControlGetHandle("classname=Winamp v1.x", "", 0) ;Gets the Winamp Handle $JFhandle = ControlGetHandle("Jump to file", "", 0) ;Gets the JTFP Handle ;If Jump to File isn't on (it shouldn't be): If ControlGetHandle($JFhandle, "", 4951)=="" Then ;Call the 'Jump to file' window DllCall ("user32.dll", "int", "SendMessage", "hwnd", $WAhandle, "int", $WM_COMMAND, "int", 40194, "int", 0) ;Wait until it loads (manually because WinExists doesn't work here) While 1 $JFhandle = ControlGetHandle("Jump to file", "", 0) If ControlGetHandle($JFhandle, "", 4951)<>"" Then ExitLoop MsgBox(0,"Error","Please be sure you're using the Classic Skin") Wend EndIf ;Get the rest of the handles $WSLhandle = ControlGetHandle($JFhandle, "", 1122) ;Gets the Songs ListBox Handle $WSBLhandle = ControlGetHandle($JFhandle, "", 1206) ;Gets the InputBox Handle $WQLhandle = ControlGetHandle($JFhandle, "", 4951) ;Gets the Queue ListBox Handle $QUEBhandle = ControlGetHandle($JFhandle, "", 4919) ;Gets the Enqueue File Button Handle $REMBhandle = ControlGetHandle($JFhandle, "", 4960) ;Gets the Remove File Button Handle $JTFBhandle = ControlGetHandle($JFhandle, "", 4918) ;Gets the Jump to File Button Handle $MNGBhandle = ControlGetHandle($JFhandle, "", 4933) ;Gets the Manage Mode Button Handle $CLSBhandle = ControlGetHandle($JFhandle, "", 0002) ;Gets the Close Button Handle ;GUI: $main = GUICreate ("Jump to File Plugin -- External Control v0.98.5b", 800, 480, 0, 0, $WS_POPUPWINDOW) ;Creates the GUI (NOT Always on TOP) GUICtrlCreatePic ("images\background.jpg", 0, 0, 800, 480, 0, 0) ;Sets the background image ;GUI Elements: $txtSearch = GUICtrlCreateInput ("", 11, 268, 292, 22, BitXOR($ES_UPPERCASE, $ES_AUTOHSCROLL)) GUICtrlSetFont($txtSearch, 14) $btnEnter = GUICtrlCreateButton ("Enter", 285, 269, 40, 20, $BS_DEFPUSHBUTTON) GUICtrlSetState($btnEnter, $GUI_HIDE) ;hide the Enter button $lstSongs = GUICtrlCreateList ("", 10, 5, 294, 280, BitXOR($LBS_SORT, $WS_BORDER)) GUICtrlSetFont($lstSongs, 14) ;set listbox font to #12 $lstQueue = GUICtrlCreateList ("", 496, 5, 294, 300, BitXOR($LBS_SORT, $WS_BORDER)) ;475 GUICtrlSetFont($lstQueue, 14) $btnPlay = GUICtrlCreateButton("&Play", 335, 6, 130, 67.5, $BS_BITMAP) GUICtrlSetImage($btnPlay, "Images\btnPlay.bmp") $btnQueue = GUICtrlCreateButton("&Queue -->", 335, 78.5, 130, 67.5, $BS_BITMAP) GUICtrlSetImage($btnQueue, "Images\btnQueue.bmp") $btnRemove = GUICtrlCreateButton("<-- &Remove", 335, 150, 130, 67.5, $BS_BITMAP) GUICtrlSetImage($btnRemove, "Images\btnRemove.bmp") $btnCancel = GUICtrlCreateButton("Cancel", 335, 222.5, 130, 67.5, $BS_BITMAP) GUICtrlSetImage($btnCancel, "Images\btnCancel.bmp") $btnClear = GUICtrlCreateButton("&Clear", 335, 222.5, 130, 67.5, $BS_BITMAP) GUICtrlSetImage($btnClear, "Images\btnClear.bmp") GUICtrlSetState($btnClear, $GUI_HIDE) ;hide the Clear button ;Song List Nav Buttons: $btnSListPU = GUICtrlCreateButton("/\", 304, 6, 25, 67.5, $BS_BITMAP) ;Create Button Song List Page Up GUICtrlSetImage($btnSListPU, "Images\btnPageUp.bmp") $btnSListIU = GUICtrlCreateButton("^",304, 78.5, 25, 67.5, $BS_BITMAP) ;Create Button Song List Item Up GUICtrlSetImage($btnSListIU, "Images\btnUp.bmp") $btnSListID = GUICtrlCreateButton("v", 304, 150, 25, 67.5, $BS_BITMAP) ;Create Button Song List Item Down GUICtrlSetImage($btnSListID, "Images\btnDown.bmp") $btnSListPD = GUICtrlCreateButton("\/", 304, 222.5, 25, 67.5, $BS_BITMAP) ;Create Button Song List Page Down GUICtrlSetImage($btnSListPD, "Images\btnPageDown.bmp") ;Queue List Nav Buttons: $btnQListPU = GUICtrlCreateButton("/\", 471, 6, 25, 67.5, $BS_BITMAP) ;Create Button Queue List Page Up GUICtrlSetImage($btnQListPU, "Images\btnPageUp.bmp") $btnQListIU = GUICtrlCreateButton("^", 471, 78.5, 25, 67.5, $BS_BITMAP) ;Create Button Queue List Page Up GUICtrlSetImage($btnQListIU, "Images\btnUp.bmp") $btnQListID = GUICtrlCreateButton("v", 471, 150, 25, 67.5, $BS_BITMAP) ;Create Button Queue List Page Up GUICtrlSetImage($btnQListID, "Images\btnDown.bmp") $btnQListPD = GUICtrlCreateButton("\/", 471, 222.5, 25, 67.5, $BS_BITMAP) ;Create Button Queue List Page Up GUICtrlSetImage($btnQListPD, "Images\btnPageDown.bmp") ;OSK Elements: ;Row 1: $keyQ = GUICtrlCreateButton("Q", 8, 295, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyQ, "Images\btnQ.bmp") $keyW = GUICtrlCreateButton("W", 66, 295, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyW, "Images\btnW.bmp") $keyE = GUICtrlCreateButton("E", 124, 295, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyE, "Images\btnE.bmp") $keyR = GUICtrlCreateButton("R", 182, 295, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyR, "Images\btnR.bmp") $keyT = GUICtrlCreateButton("T", 240, 295, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyT, "Images\btnT.bmp") $keyY = GUICtrlCreateButton("Y", 298, 295, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyY, "Images\btnY.bmp") $keyU = GUICtrlCreateButton("U", 356, 295, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyU, "Images\btnU.bmp") $keyI = GUICtrlCreateButton("I", 414, 295, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyI, "Images\btnI.bmp") $keyO = GUICtrlCreateButton("O", 472, 295, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyO, "Images\btnO.bmp") $keyP = GUICtrlCreateButton("P", 530, 295, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyP, "Images\btnP.bmp") ;NumPad: $key7 = GUICtrlCreateButton("7", 624, 295, 50, 40, $BS_BITMAP) GUICtrlSetImage($key7, "Images\btn7.bmp") $key8 = GUICtrlCreateButton("8", 682, 295, 50, 40, $BS_BITMAP) GUICtrlSetImage($key8, "Images\btn8.bmp") $key9 = GUICtrlCreateButton("9", 740, 295, 50, 40, $BS_BITMAP) GUICtrlSetImage($key9, "Images\btn9.bmp") ;Row 2: $keyA = GUICtrlCreateButton("A", 8, 340, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyA, "Images\btnA.bmp") $keyS = GUICtrlCreateButton("S", 66, 340, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyS, "Images\btnS.bmp") $keyD = GUICtrlCreateButton("D", 124, 340, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyD, "Images\btnD.bmp") $keyF = GUICtrlCreateButton("F", 182, 340, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyF, "Images\btnF.bmp") $keyG = GUICtrlCreateButton("G", 240, 340, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyG, "Images\btnG.bmp") $keyH = GUICtrlCreateButton("H", 298, 340, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyH, "Images\btnH.bmp") $keyJ = GUICtrlCreateButton("J", 356, 340, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyJ, "Images\btnJ.bmp") $keyK = GUICtrlCreateButton("K", 414, 340, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyK, "Images\btnK.bmp") $keyL = GUICtrlCreateButton("L", 472, 340, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyL, "Images\btnL.bmp") $keyApostrophe = GUICtrlCreateButton("'", 530, 340, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyApostrophe, "Images\btnApostrophe.bmp") ;NumPad: $key4 = GUICtrlCreateButton("4", 624, 340, 50, 40, $BS_BITMAP) GUICtrlSetImage($key4, "Images\btn4.bmp") $key5 = GUICtrlCreateButton("5", 682, 340, 50, 40, $BS_BITMAP) GUICtrlSetImage($key5, "Images\btn5.bmp") $key6 = GUICtrlCreateButton("6", 740, 340, 50, 40, $BS_BITMAP) GUICtrlSetImage($key6, "Images\btn6.bmp") ;Row 3: $keyZ = GUICtrlCreateButton("Z", 8, 385, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyZ, "Images\btnZ.bmp") $keyX = GUICtrlCreateButton("X", 66, 385, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyX, "Images\btnX.bmp") $keyC = GUICtrlCreateButton("C", 124, 385, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyC, "Images\btnC.bmp") $keyV = GUICtrlCreateButton("V", 182, 385, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyV, "Images\btnV.bmp") $keyB = GUICtrlCreateButton("B", 240, 385, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyB, "Images\btnB.bmp") $keyN = GUICtrlCreateButton("N", 298, 385, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyN, "Images\btnN.bmp") $keyM = GUICtrlCreateButton("M", 356, 385, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyM, "Images\btnM.bmp") $keyComma = GUICtrlCreateButton(",", 414, 385, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyComma, "Images\btnComma.bmp") $keyHyphen = GUICtrlCreateButton("-", 472, 385, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyHyphen, "Images\btnHyphen.bmp") ;NumPad: $key1 = GUICtrlCreateButton("1", 624, 385, 50, 40, $BS_BITMAP) GUICtrlSetImage($key1, "Images\btn1.bmp") $key2 = GUICtrlCreateButton("2", 682, 385, 50, 40, $BS_BITMAP) GUICtrlSetImage($key2, "Images\btn2.bmp") $key3 = GUICtrlCreateButton("3", 740, 385, 50, 40, $BS_BITMAP) GUICtrlSetImage($key3, "Images\btn3.bmp") ;Row 4: $keySpace = GUICtrlCreateButton("SPACE", 8, 430, 282, 40, $BS_BITMAP) GUICtrlSetImage($keySpace, "Images\btnSpace.bmp") $keyBackspace = GUICtrlCreateButton("BACKSPACE", 298, 430, 166, 40, $BS_BITMAP) GUICtrlSetImage($keyBackspace, "Images\btnBackspace.bmp") ;$keyLeft = GUICtrlCreateButton("<==", 472, 430, 50, 40) ;$keyRight = GUICtrlCreateButton("==>", 530, 430, 50, 40) ;NumPad: $key0 = GUICtrlCreateButton("0", 624, 430, 110, 40, $BS_BITMAP) GUICtrlSetImage($key0, "Images\btn0.bmp") $keyPeriod = GUICtrlCreateButton(".", 740, 430, 50, 40, $BS_BITMAP) GUICtrlSetImage($keyPeriod, "Images\btnPeriod.bmp") ;Initialize ClearJF() ;Clear JTFP's input box ;if the list is empty after clearing, notify of error: If _GUICtrlListCount($WSLhandle)=0 Then MsgBox(0,"Error:","Playlist is Empty") WinActivate ($main) ;Focuses on the GUI window GUICtrlSetState ($txtSearch, $GUI_FOCUS) ;Focuses on the Search Text Box QInit() ;Initializes the Queue ListBox GUISetState (@SW_SHOW, $main) ;Shows the GUI While 1 $msg = GUIGetMsg() ;Get GUI messages ClearCancelState() ;Checks for input text, sets the clear/cancel button accordingly $SItems = _GUICtrlListCount($WSLhandle) ;Gets the number of items in Winamp's song list $QItems = ControlListView ($JFhandle, "", "SysListView321", "GetItemCount") ;Gets the number of items in the queue list Select ;Check the GUI messages Case $msg = $GUI_EVENT_CLOSE ;if 'X' or 'Esc' is pressed, exit. DllCall ("user32.dll", "int", "SendMessage", "hwnd", $CLSBhandle, "int", $BM_CLICK, "int", 0, "int", 0) ;Clicks on the Clo&se File button ExitLoop Case $msg = $btnCancel ;if 'Cancel' is pressed, exit. DllCall ("user32.dll", "int", "SendMessage", "hwnd", $CLSBhandle, "int", $BM_CLICK, "int", 0, "int", 0) ;Clicks on the Clo&se File button ExitLoop Case $msg = $btnClear ClearJF() ;clears the Jump-to-File input box ClearEC() ;clears the External Control input box ClearCancelState() ;shows the Cancel button Case $msg = $btnQueue If (_GUICtrlListSelectedIndex($lstSongs)>=0) Then ;Check if there's a selection in lstSongs _GUICtrlListSelectIndex($WSLhandle, $SPointer + _GUICtrlListSelectedIndex($lstSongs)) ;Sets the Winamp List Index to the lstSongs' index DllCall ("user32.dll", "int", "SendMessage", "hwnd", $QUEBhandle, "int", $BM_CLICK, "int", 0, "int", 0) ;Clicks on the En&queue File button SInit() ;Updates the Song List for the '[X]' notations QInit() ;Updates the Queue List for the '#)' notations Else Beep(440,150) ;Error: Plays A4 for 150ms EndIf Case $msg = $btnRemove ;How it works: Selects the index according to lstQueue ;and presses '&Remove' button. ;It then MUST redraw the QueueList (for the '#)' to work properly) ;Local $QIndex = $QPointer + _GUICtrlListSelectedIndex($lstQueue) ;Gets the number of item to be removed Local $QIndex = _GUICtrlListSelectedIndex($lstQueue) ;Gets the number of item to be removed If $QIndex = -1 Then Beep(440,150) ;Error: Plays A4 for 150ms Else PrimitiveRemove($QIndex) ;Update the Queue list _GUICtrlListDeleteItem($lstQueue, $QIndex) ;Deletes the item $QItemsOld = $QItems ;takes note of new changes SInit() ;Updates the Song List for the [X] notations If $QIndex<>$QItems-1 Then QInit() ;If the item to be removed isn't last, redraw the Queue list EndIf Case $msg = $btnEnter $strInput = GUICtrlRead($txtSearch) ClearJF() ;Quickly clear the list (in case backspaces was used) ControlSend($WSBLhandle, "", $WSBLhandle, $strInput) ;Send the whole string to JTFP's Edit Box If _GUICtrlListCount($WSLhandle)>0 Then ;If there's at least one entry, $SItemsOld = $SItems ;Note changes $SPointer = 0 ;Set the pointer to 0, prevents it from crashing! EndIf Case $msg = $btnPlay If (_GUICtrlListSelectedIndex($lstSongs)>=0) Then ;Check if there's a selection in lstSongs _GUICtrlListSelectIndex($WSLhandle, $SPointer + _GUICtrlListSelectedIndex($lstSongs)) ;Sets the Winamp List Index to the lstSongs' index DllCall ("user32.dll", "int", "SendMessage", "hwnd", $JTFBhandle, "int", $BM_CLICK, "int", 0, "int", 0) ;Clicks on the En&queue File button DllCall ("user32.dll", "int", "SendMessage", "hwnd", $CLSBhandle, "int", $BM_CLICK, "int", 0, "int", 0) ;Clicks on the Clo&se File button ExitLoop Else Beep(440,150) ;Error: Plays A4 for 150ms EndIf Case $msg = $btnSListPD If $SPointer + 12 < $SItems Then ;Check if there's enough items without going over Local $SPosition = _GUICtrlListSelectedIndex($lstSongs) ;Get the currently selected item's position $SPointer = $SPointer + 12 ;Scroll a full screen (-1 item) down SInit() ;Update the list (DO IT!) _GUICtrlListSelectIndex($lstSongs, $SPosition) ;Set the previously selected item's position EndIf Case $msg = $btnSListPU If $SPointer - 12 > 0 Then ;If the pointer isn't off the list when scrolling up, Local $SPosition = _GUICtrlListSelectedIndex($lstSongs) ;Get the currently selected item's position $SPointer = $SPointer - 12 ;Scroll a full screen up SInit() ;Update the list (DO IT!) _GUICtrlListSelectIndex($lstSongs, $SPosition) ;Set the previously selected item's position Else ;If the pointer gets off the list when scrolling up, Local $SPosition = _GUICtrlListSelectedIndex($lstSongs) ;Get the currently selected item's position $SPointer = 0 ;Otherwise, scroll to the very top SInit() ;Update the list (DO IT!) _GUICtrlListSelectIndex($lstSongs, $SPointer) ;Set the selected item to the topmost one EndIf Case $msg = $btnSListID If _GUICtrlListSelectedIndex($lstSongs) >= 11 Then ;If the pointer isn't off the list when scrolling down, ;COPIED FROM: $msg = $btnSListPD, changed to 11 (from 12) If $SPointer + 11 < $SItems Then ;Check if there's enough items without going over $SPointer = $SPointer + 11 ;Scroll a full screen (-1 item) down SInit() ;Update the list (DO IT!) _GUICtrlListSelectIndex($lstSongs, 0) ;Set the previously selected item's position EndIf Else ;If trying to scroll off the list (below the bottom-most item) _GUICtrlListSelectIndex($lstSongs, _GUICtrlListSelectedIndex($lstSongs)+1) ;Select the next item EndIf Case $msg = $btnSListIU If _GUICtrlListSelectedIndex($lstSongs) <= 0 Then ;If trying to scroll off the list (above the top-most item), ;COPIED FROM: $msg = $btnSListPU If $SPointer - 11 >= 0 Then ;If the pointer isn't off the list, $SPointer = $SPointer - 11 ;Scroll a full screen up SInit() ;Update the list (DO IT!) _GUICtrlListSelectIndex($lstSongs, 11) ;Select the last visible item Else ;If the pointer is above the topmost item, $SPointer = 0 ;Scroll to the very top SInit() ;Update the list (DO IT!) EndIf Else ;Otherwise, _GUICtrlListSelectIndex($lstSongs, _GUICtrlListSelectedIndex($lstSongs)-1) ;Select the previous item EndIf Case $msg = $btnQListID ;If Scroll Queuelist Item Down is clicked, Local $index = _GUICtrlListSelectedIndex($lstQueue) ;Set $index to the selected item in the local queue list If $index + 1 > $QItems Then ;If the item indexed is the last one, _GUICtrlListSelectIndex($lstQueue, $QItems) ;Select the last item Else ;If the item indexed is not the last one, _GUICtrlListSelectIndex($lstQueue, $index + 1) ;Select the next item EndIf Case $msg = $btnQListIU ;If Scroll Queuelist Item Up is clicked, Local $index = _GUICtrlListSelectedIndex($lstQueue) ;Set $index to the selected item in the local queue list If $index - 1 < 0 Then ;If the item indexed is the first one, _GUICtrlListSelectIndex($lstQueue, 0) ;Select the first item Else ;If the item indexed is not the first one, _GUICtrlListSelectIndex($lstQueue, $index - 1) ;Select the previous item EndIf Case $msg = $btnQListPD If _GUICtrlListGetTopIndex($lstQueue) + 11 > $lstQueue Then ;If the scroll to item is more than the total items, _GUICtrlListSetTopIndex($lstQueue, $QItems - 11) ;Scroll so that the last item shows on the bottom Else _GUICtrlListSetTopIndex($lstQueue, _GUICtrlListGetTopIndex($lstQueue) + 11) ;Otherwise, scroll one page down EndIf _GUICtrlListSelectIndex($lstQueue, _GUICtrlListGetTopIndex($lstQueue)) ;Set the selected item to the top of the visible list Case $msg = $btnQListPU If _GUICtrlListGetTopIndex($lstQueue) - 11 < 0 Then ;If the scroll to item is less than zero, _GUICtrlListSetTopIndex($lstQueue, 0) ;Scroll to the first item Else _GUICtrlListSetTopIndex($lstQueue, _GUICtrlListGetTopIndex($lstQueue) - 11) ;Otherwise, scroll one page up EndIf _GUICtrlListSelectIndex($lstQueue, _GUICtrlListGetTopIndex($lstQueue)) ;Set the selected item to the top of the list EndSelect OSK($msg) ;Check the OSK Case If $SItemsOld<>$SItems Then ;Checks if the song list has been updated since SInit() ;re-draw $SItemsOld = $SItems ;takes note of new changes EndIf If $QItemsOld<>$QItems Then ;Checks if the queue list has been updated since QInit() SInit() ;$QItemsOld = $QItems ;takes note of new changes EndIf If ControlListView($JFhandle, "", "SysListView321", "GetText", 0, 0)=="There are no files in the queue" Then _GUICtrlListDeleteItem($lstQueue, 0) EndIf Wend Func ClearJF() ControlSend($WSBLhandle, "", $WSBLhandle, "+{HOME}") ;Send SHIFT + HOME to the Edit Box ControlSend($WSBLhandle, "", $WSBLhandle, "{DEL}") ;Send DELETE to the Edit Box EndFunc Func ClearEC() GUICtrlSetData($txtSearch, "") ;Send nothing to Search Box, AKA Clear EndFunc Func SmartDelay() ;INSTEAD: Make it relative to the number of items in the Song List #comments-start OLD SmartDelay() Local $SDSItems = _GUICtrlListCount($WSLhandle) If ($SDSItems/10)>500 Then Sleep($SDSItems/10) Else Sleep(500) EndIf #comments-end Sleep(500) ;Adjust figure to best performance. EndFunc Func ClearCancelState() ;Swaps between the Cancel and Clear buttons according to the lstSongs and txtSearch selection If GUICtrlGetState($btnCancel)==80 Then If GUICtrlRead($txtSearch)<>"" Then GUICtrlSetState($btnCancel, $GUI_HIDE) GUICtrlSetState($btnClear, $GUI_SHOW) EndIf EndIf If GUICtrlGetState($btnClear)==80 Then If GUICtrlRead($txtSearch)=="" Then GUICtrlSetState($btnClear, $GUI_HIDE) GUICtrlSetState($btnCancel, $GUI_SHOW) EndIf EndIf EndFunc Func QInit() ;Redraws the Queue ListBox _GUICtrlListClear($lstQueue) ;Clear the list $QItems = ControlListView ($JFhandle, "", "SysListView321", "GetItemCount") ;Gets the number of items in the queue list If $QItems<>0 AND ControlListView($JFhandle, "", "SysListView321", "GetText", 0, 0)<>"There are no files in the queue" Then For $i = 0 to ($QItems - 1) If ($i+1)<10 then ;if $i+1 is a single digit (1 thru 9) _GUICtrlListAddItem($lstQueue, "0" & $i+1 & ") " & _ ControlListView($JFhandle, "", "SysListView321", "GetText", $i, 0)) ;ADDS the last item Else ;if $i+1 is a double digit (10 thru 99) _GUICtrlListAddItem($lstQueue, $i+1 & ") " & _ ControlListView($JFhandle, "", "SysListView321", "GetText", $i, 0)) ;ADDS the last item EndIf Next _GUICtrlListSelectIndex($lstQueue, 0) ;Select the top entry in the queue list EndIf $QItemsOld = $QItems ;takes note of new changes EndFunc Func SInit() #comments-start OLD SInit() ;Clears the current list _GUICtrlListClear($lstSongs) ;Loop to load all of the entries into an array: Local $ISItems = _GUICtrlListCount($WSLhandle) ;Gets the number of items in the list If $ISItems<>0 Then For $i = 0 to ($ISItems - 1) ;'($ISItems - 1)' eliminates the last '0' entry. _GUICtrlListAddItem($lstSongs, _GUICtrlListGetText($WSLhandle, $i)) ;Writes WA's Song List into lstSongs Next EndIf _GUICtrlListSelectIndex($lstSongs, 0) ;Select the top entry in the queue list ;Consider adding: $SItemsOld = $SItems #comments-end ; start here! ; Already have $SItems, $SPointer, and $SLimiter _GUICtrlListClear($lstSongs) ;Clears the current list Local $SLimiter = $SPointer + 12 ;Adjust the limiter if the pointer has changed ;If $SLimiter > ($SItems-1) Then $SLimiter = ($SItems-1) ;If there are less items than a full list, set the limiter to that. If $SLimiter > $SItems Then $SLimiter = $SItems ;If there are less items than a full list, set the limiter to that. If $SLimiter > 0 Then ;Ensures the list isn't empty If $SItems >= $SLimiter Then ;If the Winamp song list is larger than the pointer to the last item in the song list For $i = $SPointer to ($SLimiter-1) _GUICtrlListAddItem($lstSongs, _GUICtrlListGetText($WSLhandle, $i)) ;MsgBox(0,"",$i) Next Else ;If the pointer to the last item in the song list is larger than the Winamp song list MsgBox(0,"Error:", "SInit(): This isn't supposed to happen!") ;This HAS to be taken care of so that it never happens. EndIf EndIf _GUICtrlListSelectIndex($lstSongs, 0) ;Set the selected item to the top of the list ;Consider adding: (IS IT NEEDED?!) $SItemsOld = $SItems EndFunc Func PrimitiveRemove(ByRef $QRIndex) ControlFocus($WQLhandle, "", $WQLhandle) Send("{HOME}") For $i = 1 to $QRindex Send("{DOWN}") Next DllCall ("user32.dll", "int", "SendMessage", "hwnd", $REMBhandle, "int", $BM_CLICK, "int", 0, "int", 0) ;Clicks on the &Remove File button WinActivate($main) EndFunc Func OSK(ByRef $k) Select Case $k = $keyQ $s="Q" SendKey($s) Case $k = $keyW $s="W" SendKey($s) Case $k = $keyE $s="E" SendKey($s) Case $k = $keyR $s="R" SendKey($s) Case $k = $keyT $s="T" SendKey($s) Case $k = $keyY $s="Y" SendKey($s) Case $k = $keyU $s="U" SendKey($s) Case $k = $keyI $s="I" SendKey($s) Case $k = $keyO $s="O" SendKey($s) Case $k = $keyP $s="P" SendKey($s) Case $k = $keyA $s="A" SendKey($s) Case $k = $keyS $s="S" SendKey($s) Case $k = $keyD $s="D" SendKey($s) Case $k = $keyF $s="F" SendKey($s) Case $k = $keyG $s="G" SendKey($s) Case $k = $keyH $s="H" SendKey($s) Case $k = $keyJ $s="J" SendKey($s) Case $k = $keyK $s="K" SendKey($s) Case $k = $keyL $s="L" SendKey($s) Case $k = $keyApostrophe $s="'" SendKey($s) Case $k = $keyZ $s="Z" SendKey($s) Case $k = $keyX $s="X" SendKey($s) Case $k = $keyC $s="C" SendKey($s) Case $k = $keyV $s="V" SendKey($s) Case $k = $keyB $s="B" SendKey($s) Case $k = $keyN $s="N" SendKey($s) Case $k = $keyM $s="M" SendKey($s) Case $k = $keyComma $s="," SendKey($s) Case $k = $keyHyphen $s="-" SendKey($s) Case $k = $keySpace $s=" " SendKey($s) Case $k = $keyBackspace $s="{BACKSPACE}" SendKey($s) Case $k = $key0 $s="0" SendKey($s) Case $k = $keyPeriod $s="." SendKey($s) Case $k = $key1 $s="1" SendKey($s) Case $k = $key2 $s="2" SendKey($s) Case $k = $key3 $s="3" SendKey($s) Case $k = $key4 $s="4" SendKey($s) Case $k = $key5 $s="5" SendKey($s) Case $k = $key6 $s="6" SendKey($s) Case $k = $key7 $s="7" SendKey($s) Case $k = $key8 $s="8" SendKey($s) Case $k = $key9 $s="9" SendKey($s) EndSelect EndFunc Func SendKey(ByRef $str) ;First type to Winamp's JTF search box ;Then type to the txtSearch If ControlGetText($WSBLhandle,"",$WSBLhandle)<>GUICtrlRead($txtSearch) Then ;checks if the Winamp Input Box = to the text in the plugin's input box $strInput = GUICtrlRead($txtSearch) ClearJF() ;Quickly clear the Winamp input box (in case backspaces was used) ControlSend($WSBLhandle, "", $WSBLhandle, $strInput) ;Send the whole string to JTFP's Edit Box EndIf ControlSend($WSBLhandle, "", $WSBLhandle, $str) ;Send Key to JTFP's Edit Box ;SmartDelay() ;Necessary! Otherwise AutoIt v3 Crashes! NOW CRASHES WHEN SLEEP IS APPLIED! ;Sleep(1000) ;MsgBox(0,"Check","Checking") If StringLen($str)>1 Then ;If $str is BackspaceKey, etc. GUICtrlSetState ($txtSearch, $GUI_FOCUS) ;Focuses on the Search Text Box Send("{END}") ;De-select the text Send($str) ;Less Accurate Else GUICtrlSetData($txtSearch, GUICtrlRead($txtSearch) & $str) ;Send key to Search Box -- More Accurate EndIf If _GUICtrlListCount($WSLhandle)>0 Then ;If there's at least one entry, ;SInit() ;Redraw the Song List <--- SUSPECT! $SItemsOld = $SItems ;Note changes $SPointer = 0 ;Set the selected item to the top of the entire list ;SInit() ;Suspect moved down here <--- ;_GUICtrlListSelectIndex($lstSongs, 0) ;Set the selected item to the top of the list <-- Temp! ;MsgBox(0,"CHECK:",_GUICtrlListCount($WSLhandle)) ;_GUICtrlListSelectIndex($lstSongs, 0) ;Select the top entry in the list EndIf EndFunc