Jump to content

List Display and Func's


Recommended Posts

Ok, for the game Diablo II you can have "Plugins" using D2Loader, I made a Plugin Manager that will monitor which .dll's r in the folder there will be two lists displayed... it will display enabled and disabled... now it will disable by just moving to a different folder... and the active ones will be in there still... well my problem is that I cant get them to show up in the list.. I hope u can c better from what I was trying to do.

Global $var1
$diablopath = RegRead("HKCU\Software\Blizzard Entertainment\Diablo II", "InstallPath")
$FileList = _FileListToArray($diablopath & "\Plugin\*.dll")
_ArrayDisplay($FileList)
Func _PluginManager()
    $var1 = 0
    _KillAll()
    $Form3 = GUICreate("Plugin Manager", 272, 254, 193, 125)
    GUICtrlCreateLabel("Active D2Loader Plugins:", 48, 16, 178, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $List14 = GUICtrlCreateList("", 32, 40, 209, 84)
    GUICtrlCreateLabel("Disabled D2Loader Plugins:", 38, 126, 198, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $List24 = GUICtrlCreateList("", 32, 151, 209, 84)
    GUISetState(@SW_SHOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    
    While 1
        Sleep(100)
        $FileList = _FileListToArray($diablopath & "\Plugin\*.dll")
        GUICtrlSetData($List14, $FileList)
        If $var1 = 1 Then ExitLoop
    WEnd
EndFunc ;==>_PluginManager

Func _Exit()
    _exitgui()
    $var1 = 1
EndFunc ;==>_Exit
Edited by tlokz
Link to comment
Share on other sites

How's this?

#include <GuiConstantsEx.au3>
#include <array.au3>
#include <File.au3>
Global $var1 = 0
$diablopath = RegRead("HKCU\Software\Blizzard Entertainment\Diablo II", "InstallPath")
$RemovedPluginDirectory = $diablopath & "\Removed"


_PluginManager()

Func _PluginManager()
    $var1 = 0
    _KillAll()
    $Form3 = GUICreate("Plugin Manager", 272, 254, 193, 125)
    GUICtrlCreateLabel("Active D2Loader Plugins:", 48, 16, 178, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $List14 = GUICtrlCreateList("", 32, 40, 209, 84)
    _GenerateList($List14,$diablopath)
    GUICtrlCreateLabel("Disabled D2Loader Plugins:", 38, 126, 198, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $List24 = GUICtrlCreateList("", 32, 151, 209, 84)
    _GenerateList($List24,$RemovedPluginDirectory)
    
    GUISetState(@SW_SHOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")
    
    
    While 1
        Sleep(100)
        If $var1 = 1 Then ExitLoop
    WEnd
EndFunc;==>_PluginManager


Func _GenerateList($hListToUse,$vDirectoryToSearch)
    
    $aFileList = _FileListToArray($vDirectoryToSearch,"*.dll")

    For $i = 1 to Ubound($aFileList) -1
        GuiCtrlSetData($hListToUse,$aFileList[$i])
    Next
        
EndFunc


Func _Exit()
  ; _exitgui()
    $var1 = 1
EndFunc;==>_Exit
Link to comment
Share on other sites

Yay this is what I was looking for :)

Edit: Now how do u on click of an acitve plugin it switched folder.. or vice versa

With GUICtrlSetOnEvent(-1, "MyFunc")

I got it to call something... Now how to get the text? That called it so it can move that plugin

Edited by tlokz
Link to comment
Share on other sites

Well I went ahead and found out how to do it :)

Here for anybody else that would like something like this:

Global $var1, $List14, $List24
$diablopath = RegRead("HKCU\Software\Blizzard Entertainment\Diablo II", "InstallPath")
$RemovedPluginDirectory = $diablopath & "\Removed"
$PluginDirectory = $diablopath & "\Plugin"

Func _PluginManager()
    $var1 = 0
    _KillAll()
    Opt("GUIOnEventMode", 1)
    GUICreate("Plugin Manager", 272, 254, 193, 125)
    GUICtrlCreateLabel("Active D2Loader Plugins:", 48, 16, 178, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $List14 = GUICtrlCreateList("", 32, 40, 209, 84, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
    GUICtrlSetOnEvent(-1, "_MoveToDisabled")
    _GenerateList($List14, $PluginDirectory)
    GUICtrlCreateLabel("Disabled D2Loader Plugins:", 38, 126, 198, 20)
    GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
    $List24 = GUICtrlCreateList("", 32, 151, 209, 84, BitOR($LBS_STANDARD, $LBS_EXTENDEDSEL))
    GUICtrlSetOnEvent(-1, "_MoveToGood")
    _GenerateList($List24, $RemovedPluginDirectory)

    GUISetState(@SW_SHOW)
    GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit")

    While 1
        Sleep(100)
        If $var1 = 1 Then ExitLoop
    WEnd
EndFunc  ;==>_PluginManager

Func _GenerateList($hListToUse, $vDirectoryToSearch)
    $aFileList = _FileListToArray($vDirectoryToSearch, "*.dll")
    For $i = 1 To UBound($aFileList) - 1
        GUICtrlSetData($hListToUse, $aFileList[$i])
    Next
EndFunc  ;==>_GenerateList

Func _MoveToDisabled()
    Local $sItems, $aItems
    $aItems = _GUICtrlListBox_GetSelItemsText($List14)
    For $iI = 1 To $aItems[0]
        $sItems &= $aItems[$iI]
    Next
    FileMove($PluginDirectory & "\" & $sItems, $RemovedPluginDirectory & "\" & $sItems, 9)
    Sleep(100)
    GUICtrlSetData($List14, "")
    GUICtrlSetData($List24, "")
    _GenerateList($List14, $PluginDirectory)
    _GenerateList($List24, $RemovedPluginDirectory)
EndFunc  ;==>_MoveToDisabled

Func _MoveToGood()
    Local $sItems, $aItems
    $aItems = _GUICtrlListBox_GetSelItemsText($List24)
    For $iI = 1 To $aItems[0]
        $sItems &= $aItems[$iI]
    Next
    FileMove($RemovedPluginDirectory & "\" & $sItems, $PluginDirectory & "\" & $sItems, 9)
    Sleep(100)
    GUICtrlSetData($List14, "")
    GUICtrlSetData($List24, "")
    _GenerateList($List14, $PluginDirectory)
    _GenerateList($List24, $RemovedPluginDirectory)
EndFunc  ;==>_MoveToGood

Func _Exit()
    _exitgui()
    $var1 = 1
EndFunc  ;==>_Exit

Func _exitgui()
    GUIDelete("")
EndFunc  ;==>_exitgui
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...