Below is my script. It runs a BatchIconExtractor program and extracts icons to a folder called icons in the script directory. The probelm i'm having is that the ListIcon() function count works with the released version but not the beta Version of autoit. Not sure why. Just putting it out there for the people who could actually figure out what is going on. The Batch Icon extractor EXE can be found at on this web site. I also uploaded it to this post. http://www.rw-designer.com/batch-icon-extractor #cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.3.2 (beta)
Author: AceOfAllTrades
Script Function:
Wrapper for the Batch Icon Extractor.
http://www.rw-designer.com/batch-icon-extractor
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
#include <GUIConstants.au3>
#Include <GuiList.au3>
#NoTrayIcon
Global $IconLocation,$list_CurrentIcons,$ListCount,$lbl_IconNum
If Not FileExists(@ScriptDir & "\BatchIconExtractor.exe") Then
msgbox(0,"BatchIconExtractor.exe Missing", "BatchIconExtractor.exe needs to be located in the same directory as this File." & @CRLF & "Please download it from http://www.rw-designer.com/batch-icon-extractor")
Exit
EndIf
$IconLocation=@ScriptDir & "\icons"
$IconExtractor = GUICreate("Batch Icon Extraxtor Wrapper", 633, 447, -1, -1, -1, $WS_EX_ACCEPTFILES)
GUISetIcon("I:\Scripts\Autoit\IconExtractor\BatchIconExtractor.ico")
$in_Location = GUICtrlCreateInput("", 10, 60, 300, 35)
GUICtrlSetState(-1,$GUI_ACCEPTFILES)
$list_CurrentIcons = GUICtrlCreateList("", 315, 10, 310, 422)
$but_getIcon = GUICtrlCreateButton("Get Icon", 10, 100, 75, 25, 0)
$but_Open = GUICtrlCreateButton("Open Folder", 85, 100, 75, 25, 0)
$but_Delete = GUICtrlCreateButton("Delete Icon", 160, 100, 75, 25, 0)
$but_Exit = GUICtrlCreateButton("Exit", 235, 100, 75, 25, 0)
$lbl_Input = GUICtrlCreateLabel("Drag and Drop Files or Folders", 10, 30, 300, 25)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x808080)
$pic_Preview = GUICtrlCreateIcon("", -1,10, 300, 128, 128)
$lbl_Preview = GUICtrlCreateLabel("Icon Preview", 13, 264, 128, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x808080)
$lbl_TotIcons = GUICtrlCreateLabel("Total # of Icons", 155, 265, 150, 28)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x808080)
$lbl_IconNum = GUICtrlCreateLabel("", 155, 300, 150, 28,$SS_CENTER)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFFFFFF)
GUICtrlSetBkColor(-1, 0x808080)
GUISetState(@SW_SHOW)
ListIcon()
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg=$GUI_EVENT_Minimize
WinSetState("Batch Icon","",@SW_MINIMIZE)
Case $msg = $GUI_EVENT_DROPPED
_GUICtrlListAddItem ($in_Location, @GUI_DRAGFILE)
Case $msg=$but_getIcon
$get_Icon=GUICtrlRead($in_Location)
If $get_Icon="" Then
MsgBox(0,"Error","Please enter a file or folder to get Icons From",20)
Else
RunWait(@ScriptDir & "\Batchiconextractor.exe " & chr(34) & $get_Icon & Chr(34))
ListIcon()
EndIf
Case $msg=$but_Delete
$ListSel=Guictrlread($list_CurrentIcons)
If $ListSel="" Then
Msgbox(0,"Error", "Please Select an Icon to Delete from the List.",20)
Else
FileDelete(@ScriptDir & "\icons\" & $ListSel)
GUICtrlSetImage($pic_Preview,"")
ListIcon()
EndIf
Case $msg=$but_Open
$ListSel=Guictrlread($list_CurrentIcons)
If $ListSel="" Then
Run(@WindowsDir & "\Explorer.exe /root," & @ScriptDir & "\Icons")
Else
Run(@WindowsDir & "\Explorer.exe /select," & @ScriptDir & "\Icons\" & $ListSel)
EndIf
Case $msg = $list_CurrentIcons
$ListSel=Guictrlread($list_CurrentIcons)
GUICtrlSetImage($pic_Preview,@ScriptDir & "\icons\" & $ListSel)
Case $msg=$but_Exit
Exitloop
Case Else
EndSelect
WEnd
Func ListIcon()
_GUICtrlListClear($list_CurrentIcons)
$search = FileFindFirstFile($IconLocation & "\*.ico")
While 1
$file = FileFindNextFile($search)
If @error Then ExitLoop
_GUICtrlListAddItem ($list_CurrentIcons, $file)
$ListCount=_GUICtrlListCount($list_CurrentIcons)
GUICtrlSetData($lbl_IconNum,$ListCount,"0")
WEnd
FileClose($search)
EndFunc