gottygolly Posted December 8, 2014 Share Posted December 8, 2014 I saw a code earlier today and I copied a line in it but for some reason it won't work in my code. I don't know what i'm missing or adding but could someone please explain this to me? My Code: $gui = GUICreate("",640,480,-1,-1) Opt("GUIOnEventMode",1) GUISetOnEvent(-3,"_Exit") GUISetState() Dim $to[11] $g = 5 For $x = 1 To UBound($to) - 1 $b[$x] = GUICtrlCreateButton("Button",5,$g,100,30) $g+=35 Next While 1 Sleep(10) WEnd Func _Exit() Exit EndFunc Other Code: expandcollapse popup#include<Array.au3> #include<DateTimeConstants.au3> #include<GUIConstantsEx.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> #include<GUIConstants.au3> #include<Array.au3> #include<Misc.au3> #include <Sound.au3> #include <GuiComboBox.au3> #include <Date.au3> #include <String.au3> #include<guicomboboxex.au3> #Region;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Outfile=..\Test.exe #EndRegion;**** Directives created by AutoIt3Wrapper_GUI **** Opt("GUIOnEventMode", 1) Global $label,$Progress $Form1 = GUICreate("Countdown", 361, 445, 384, 252) $Combo1 = GUICtrlCreateCombo("", 240, 8, 113, 25, BitOR($CBS_DROPDOWNLIST, $CBS_SORT)) GUICtrlSetOnEvent(-1, "combo_change") GUICtrlSetResizing(-1, $GUI_DOCKALL) $Date = GUICtrlCreateDate("", 5, 5, 70, 20, $DTS_TIMEFORMAT) Dim $label[11] Dim $Progress[11] $g = 0 For $x = 1 To UBound($label) - 1 $Progress[$x] = GUICtrlCreateProgress(8, 40 + $g, 169, 17) GUICtrlSetColor(-1, 0x00FF00) GUICtrlSetBkColor(-1, 0x00ff00) DllCall("UxTheme.dll", "int", "SetWindowTheme", "hwnd", GUICtrlGetHandle(-1), "wstr", " ", "wstr", " ") GUICtrlSetStyle(-1, 1) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetState(-1,$GUI_DISABLE) $label[$x] = GUICtrlCreateLabel("this is a test label", 8, 40 + $g, 120, 17,$SS_NOTIFY) GUICtrlSetOnEvent(-1, "label_test") GUICtrlSetFont(-1, 12, 800, 0, "MS Sans Serif") GUICtrlSetColor(-1,0) GUICtrlSetResizing(-1, $GUI_DOCKALL) GUICtrlSetBkColor($label[$x], $GUI_BKCOLOR_TRANSPARENT) $g += 20 GUISetOnEvent($GUI_EVENT_CLOSE,"closeall") Next GUISetState(@SW_SHOW) _GUICtrlComboBoxEx_SetCurSel(GUICtrlGetHandle($Combo1), 0) While 1 Sleep(50) WEnd Func closeall() Exit EndFunc Func label_test() ConsoleWrite("Label" & @LF) Local $iD = @GUI_CtrlId $sea = _ArraySearch($label, $iD) If Not @error Then MsgBox(0, "label", $iD & " " & $sea, 0) EndFunc ;==>label Func combo_change() EndFunc ;==>combo_change Thank you in advance for any support you provide! Link to comment Share on other sites More sharing options...
jguinch Posted December 8, 2014 Share Posted December 8, 2014 In your code, $b does not exists. Isn't $to instead ? $to[$x] = GUICtrlCreateButton("Button",5,$g,100,30) Spoiler Network configuration UDF, _DirGetSizeByExtension, _UninstallList Firefox ConfigurationArray multi-dimensions, Printer Management UDF Link to comment Share on other sites More sharing options...
water Posted December 8, 2014 Share Posted December 8, 2014 What do you mean by "won't work"? Could you please be a bit more specific? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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