AceOfAllTrades Posted April 4, 2007 Posted April 4, 2007 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-extractorexpandcollapse popup#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
Richard Robertson Posted April 4, 2007 Posted April 4, 2007 You never said the problem you encountered.
AceOfAllTrades Posted April 5, 2007 Author Posted April 5, 2007 You never said the problem you encountered.Sorry about that. Basiacly the numbers should count up to the total number of files that are in the list. I'm using the _GUICtrlListCount UDF to get the total count from the list view. It works under the released version ofautoit, and not the current beta version.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now