Hideous Posted June 19, 2006 Share Posted June 19, 2006 (edited) I made this program because I self had some problems on getting the right icon on my buttons Hope it's usefull for some of the starting scripters CODE #include <GUIconstants.au3> #NoTrayIcon Opt("GUIOnEventMode", 1) $GUI = GuiCreate("Shell32.dll", 310, 210,-1, -1 ) $Button_1_counter = 0 $Button_2_counter = 1 $Button_3_counter = 2 $Button_4_counter = 3 $Edit_1 = GUICtrlCreateInput( "", 10, 110, 290, 20 ) $Edit_2 = GUICtrlCreateInput( "", 10, 160, 290, 20 ) $Button_1 = GuiCtrlCreateButton("", 60, 10, 40, 40, BitOR( $BS_ICON, $BS_FLAT)) GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", $Button_1_counter) Sleep(10) $Button_2 = GuiCtrlCreateButton("", 110, 10, 40, 40, BitOR( $BS_ICON, $BS_FLAT)) GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", $Button_2_counter) Sleep(10) $Button_3 = GuiCtrlCreateButton("", 160, 10, 40, 40, BitOR( $BS_ICON, $BS_FLAT)) GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", $Button_3_counter) Sleep(10) $Button_4 = GuiCtrlCreateButton("", 210, 10, 40, 40, BitOR( $BS_ICON, $BS_FLAT)) GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", $Button_4_counter) $Button_Prev = GUICtrlCreateButton( "<<", 110, 60, 40, 20, $BS_FLAT) GUICtrlSetState( -1, $GUI_DISABLE ) $Button_Next = GUICtrlCreateButton( ">>", 160, 60, 40, 20, $BS_FLAT) GUICtrlSetOnEvent( $Button_Next, "NextItem" ) GUICtrlSetOnEvent( $Button_Prev, "PrevItem" ) GUICtrlSetOnEvent( $Button_1, "Button_1" ) GUICtrlSetOnEvent( $Button_2, "Button_2" ) GUICtrlSetOnEvent( $Button_3, "Button_3" ) GUICtrlSetOnEvent( $Button_4, "Button_4" ) GUISetOnEvent($GUI_EVENT_CLOSE, "ExitBrowser") GuiSetState() While 1 Sleep(10) WEnd Func NextItem() Select Case $Button_4_counter = 233 GUICtrlSetState( $Button_Next, $GUI_DISABLE ) GUICtrlSetState( $Button_Prev, $GUI_ENABLE ) Case $Button_4_counter = 232 $Button_1_counter = $Button_1_counter + 1 GUICtrlSetImage( $Button_1, @SystemDir & "/shell32.dll", $Button_1_counter) $Button_2_counter = $Button_2_counter + 1 GUICtrlSetImage( $Button_2, @SystemDir & "/shell32.dll", $Button_2_counter) $Button_3_counter = $Button_3_counter + 1 GUICtrlSetImage( $Button_3, @SystemDir & "/shell32.dll", $Button_3_counter) $Button_4_counter = $Button_4_counter + 1 GUICtrlSetImage( $Button_4, @SystemDir & "/shell32.dll", $Button_4_counter) GUICtrlSetState( $Button_Next, $GUI_DISABLE ) GUICtrlSetState( $Button_Prev, $GUI_ENABLE ) Case $Button_4_counter < 232 $Button_1_counter = $Button_1_counter + 1 GUICtrlSetImage( $Button_1, @SystemDir & "/shell32.dll", $Button_1_counter) $Button_2_counter = $Button_2_counter + 1 GUICtrlSetImage( $Button_2, @SystemDir & "/shell32.dll", $Button_2_counter) $Button_3_counter = $Button_3_counter + 1 GUICtrlSetImage( $Button_3, @SystemDir & "/shell32.dll", $Button_3_counter) $Button_4_counter = $Button_4_counter + 1 GUICtrlSetImage( $Button_4, @SystemDir & "/shell32.dll", $Button_4_counter) GUICtrlSetState( $Button_Prev, $GUI_ENABLE ) EndSelect EndFunc Func PrevItem() Select Case $Button_1_counter = 0 GUICtrlSetState( $Button_Prev, $GUI_DISABLE ) GUICtrlSetState( $Button_Next, $GUI_ENABLE ) Case $Button_1_counter = 1 $Button_1_counter = $Button_1_counter - 1 GUICtrlSetImage( $Button_1, @SystemDir & "/shell32.dll", $Button_1_counter) $Button_2_counter = $Button_2_counter - 1 GUICtrlSetImage( $Button_2, @SystemDir & "/shell32.dll", $Button_2_counter) $Button_3_counter = $Button_3_counter - 1 GUICtrlSetImage( $Button_3, @SystemDir & "/shell32.dll", $Button_3_counter) $Button_4_counter = $Button_4_counter - 1 GUICtrlSetImage( $Button_4, @SystemDir & "/shell32.dll", $Button_4_counter) GUICtrlSetState( $Button_Prev, $GUI_DISABLE ) GUICtrlSetState( $Button_Next, $GUI_ENABLE ) Case $Button_1_counter > 1 $Button_1_counter = $Button_1_counter - 1 GUICtrlSetImage( $Button_1, @SystemDir & "/shell32.dll", $Button_1_counter) $Button_2_counter = $Button_2_counter - 1 GUICtrlSetImage( $Button_2, @SystemDir & "/shell32.dll", $Button_2_counter) $Button_3_counter = $Button_3_counter - 1 GUICtrlSetImage( $Button_3, @SystemDir & "/shell32.dll", $Button_3_counter) $Button_4_counter = $Button_4_counter - 1 GUICtrlSetImage( $Button_4, @SystemDir & "/shell32.dll", $Button_4_counter) GUICtrlSetState( $Button_Next, $GUI_ENABLE ) EndSelect EndFunc Func Button_1() GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )') GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_1_counter & ' )' ) EndFunc Func Button_2() GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )') GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_2_counter & ' )' ) EndFunc Func Button_3() GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )') GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_3_counter & ' )' ) EndFunc Func Button_4() GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )') GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_4_counter & ' )' ) EndFunc Func ExitBrowser() Exit EndFunc Edited June 25, 2006 by Hideous [u]Its all about experience...[/u]... Link to comment Share on other sites More sharing options...
AutoItKing Posted June 19, 2006 Share Posted June 19, 2006 There's something like this in the examples directory. Nice work! http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script] Link to comment Share on other sites More sharing options...
RazerM Posted June 19, 2006 Share Posted June 19, 2006 (edited) This is really good for choosing icons. You use Chr(34) or use Func Button_1() GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )') GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_1_counter & ' )' ) EndFunc Func Button_2() GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )') GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_2_counter & ' )' ) EndFunc Func Button_3() GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )') GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_3_counter & ' )' ) EndFunc Func Button_4() GUICtrlSetData( $Edit_1, 'GuiCtrlCreateButton( "", 10, 10, 40, 40, $BS_ICON )') GUICtrlSetData( $Edit_2, 'GUICtrlSetImage( -1, @SystemDir & "/shell32.dll", ' & $Button_4_counter & ' )' ) EndFunc Edited June 19, 2006 by RazerM 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. Link to comment Share on other sites More sharing options...
Hideous Posted June 19, 2006 Author Share Posted June 19, 2006 (edited) Thnx for the Chr(34) tip , wasn't aware of that possibility Edited June 19, 2006 by Hideous [u]Its all about experience...[/u]... Link to comment Share on other sites More sharing options...
AutoItKing Posted June 20, 2006 Share Posted June 20, 2006 And try using the [ codebox] tag. Just a tip:) http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script] Link to comment Share on other sites More sharing options...
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