Lakes Posted March 19, 2006 Posted March 19, 2006 Creates an array of Buttons with all the Shell32 icons, click on any button. expandcollapse popup#include<GUIConstants.au3> $Size = 40 Dim $array[20] [12] GuiCreate('Icon Select',801,555) $IconButton = GUICtrlCreateButton("", 616, 496, 81, 41,$BS_ICON) $Label = GUICtrlCreateLabel ("", 9, 492, 591, 21 ,BitOR($SS_SUNKEN,$WS_BORDER)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") $Label1 = GUICtrlCreateLabel ("", 8, 520, 591, 21 ,BitOR($SS_SUNKEN,$WS_BORDER)) GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif") For $y = 0 to 11 For $x = 0 To 19 $Icon = ($y*20)+$x If $Icon > 233 then $Icon = 50 $array[$x][$y] = GuiCtrlCreateButton($Icon ,($x*$Size) ,($y*$Size) ,$Size ,$Size,$BS_ICON) GUICtrlSetImage ($array[$x][$y], "shell32.dll", $Icon) Next Next GuiSetState(@SW_SHOW) While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;;;;;; EndSelect For $y = 0 to 11 For $x = 0 To 19 $Icon = ($y*20)+$x If $Icon > 233 then ExitLoop Select Case $msg = $array[$x][$y] GUICtrlSetImage ($IconButton, "shell32.dll", $Icon) GUICtrlCreateIcon ("shell32.dll",$Icon, 730, 496,$size,$size) GUICtrlSetData ($Label, ' GUICtrlSetImage ($ButtonName, "shell32.dll"'&"," &$Icon &")") GUICtrlSetData ($Label1, ' GUICtrlCreateIcon ("shell32.dll"'&"," &$Icon &",$x" &",$y" &",$Size" &",$Size"&")") ; MsgBox (64,"Icon!","You have selected Icon: " &$Icon) EndSelect Next Next Wend ExitIcon_Keys.au3 2015 - Still no flying cars, instead blankets with sleeves.
RazerM Posted March 19, 2006 Posted March 19, 2006 this is good although you should add the ability to open any dll with icons in it My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Moderators SmOke_N Posted March 19, 2006 Moderators Posted March 19, 2006 Nice Job Lakes... Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
nitekram Posted March 19, 2006 Posted March 19, 2006 I have a question on your code in another post - I am sorry if I did something wrong. I think your code is great. I would like to use it to load other dll files that have icons and then have a on going list of icons. To use your code in my script I have to convert it to OnEvent. So far I have had no trouble (yea right) with changing code to meet my needs. But I have never really used the For loop and am not sure how to use the for loop to create a list of OnEvent rather than stating $array[$x][$y] = GUICtrlCreateButton($Icon , ($x * $Size) , ($y * $Size), $Size, $Size, $BS_ICON) $array[$x][$y] = GUISetOnEvent($array[$x][$y], "test") I am wondering how I can make every OnEvent = the same function call (dummy function) then use that dummy to determine which icon/button was clicked. Your code does a fine job and I am hoping there is some type of conversion. Also I was wondering if there is a help file/beginners document to OnEvent calls. Thanks for any help... 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
Lakes Posted March 19, 2006 Author Posted March 19, 2006 Thanks SmOke_N, still learning... nitekram, I have`nt used the GUISetOnEvent command yet, I`ll have a play with it and see what I can do. How do you know which .dll files have icons? 2015 - Still no flying cars, instead blankets with sleeves.
nitekram Posted March 19, 2006 Posted March 19, 2006 Thanks SmOke_N, still learning...nitekram, I have`nt used the GUISetOnEvent command yet, I`ll have a play with it and see what I can do.How do you know which .dll files have icons?There are a few - maybe we can have other people chime in with what they know. I wish that I had kept a list but I really never liked the idea of only being able to see them when changing icons for system files. Anyway one is pifmgr.dll, user32.dll, moricons.dll, Icwdial.dll, Isign32.dll - and others but I have not tested them all. There should be a list of them somewhere I am hoping someone will help us. 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
GaryFrost Posted March 19, 2006 Posted March 19, 2006 C:\Program Files\AutoIt3\Examples\GUI\Advanced\enumicons.au3 SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Lakes Posted March 19, 2006 Author Posted March 19, 2006 C:\Program Files\AutoIt3\Examples\GUI\Advanced\enumicons.au3Ah, I did`nt realise that was there...Oh well, I learned a lot by scripting my own version... 2015 - Still no flying cars, instead blankets with sleeves.
nitekram Posted March 19, 2006 Posted March 19, 2006 C:\Program Files\AutoIt3\Examples\GUI\Advanced\enumicons.au3The code from the help section - GUIGetMsg() is being used, but I am trying to do the samething using GUISetOnEvent() rather than having to call button calls that then call functions. Look at my code and you will see that I want use this type of code to shorten my coding. As with my code I may do it may times i.e. adding buttons.Here is the link to my code - I am sorry if it is not any good - I am still learning - I hope to post the finished code so others might be able to use it - but who knows - I am still just learninghttp://www.autoitscript.com/forum/index.ph...ndpost&p=162188Thanks for anyones help 2¢ All by me:"Sometimes you have to go back to where you started, to get to where you want to go." "Everybody catches up with everyone, eventually" "As you teach others, you are really teaching yourself." From my dad "Do not worry about yesterday, as the only thing that you can control is tomorrow." WIKI | Tabs; | Arrays; | Strings | Wiki Arrays | How to ask a Question | Forum Search | FAQ | Tutorials | Original FAQ | ONLINE HELP | UDF's Wiki | AutoIt PDF AutoIt Snippets | Multple Guis | Interrupting a running function | Another Send StringRegExp | StringRegExp Help | RegEXTester | REG TUTOR | Reg TUTOT 2 AutoItSetOption | Macros | AutoIt Snippets | Wrapper | Autoit Docs SCITE | SciteJump | BB | MyTopics | Programming | UDFs | AutoIt 123 | UDFs Form | UDF Learning to script | Tutorials | Documentation | IE.AU3 | Games? | FreeSoftware | Path_Online | Core Language Programming Tips Excel Changes ControlHover.UDF GDI_Plus Draw_On_Screen GDI Basics GDI_More_Basics GDI Rotate GDI Graph GDI CheckExistingItems GDI Trajectory Replace $ghGDIPDll with $__g_hGDIPDll DLL 101? Array via Object GDI Swimlane GDI Plus French 101 Site GDI Examples UEZ GDI Basic Clock GDI Detection Ternary operator
marcgforce Posted June 12, 2017 Posted June 12, 2017 Hello, just because i was looking for a solution making this script with the GUISetOnEvent() option, i post my solution based on the previous code made. #include<GUIConstants.au3> Opt("GUIOnEventMode", 1) $Size = 40 Dim $array[30] [12] $GuiIcon = GuiCreate('Sélection icone',1201,555) $IconButton = GUICtrlCreateButton("", 216, 496, 81, 41,$BS_ICON) $validerbouton = GUICtrlCreateButton("valider", 916, 496, 81, 41) GUICtrlSetOnEvent(-1,"validericone") For $y = 0 to 11 For $x = 0 To 29 $Icon = ($y*30)+$x If $Icon > 372 then $Icon = -1 $array[$x][$y] = GuiCtrlCreateButton($Icon ,($x*$Size) ,($y*$Size) ,$Size ,$Size,$BS_ICON) GUIctrlSetOnEvent(-1, "clicicone") GUICtrlSetImage ($array[$x][$y], "shell32.dll", $Icon) Next Next GUISetOnEvent($GUI_EVENT_CLOSE, "SpecialEvents") GUISetState(@SW_SHOW) func clicicone() global $Icon = GUICtrlRead(@GUI_CtrlId) GUICtrlSetImage ($IconButton,"shell32.dll", $Icon) EndFunc func validericone() msgbox(0,"icone", "You have selected icon number : " & $Icon,3) EndFunc Func SpecialEvents() Exit EndFunc While 1 Sleep(100) WEnd
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