Rawox Posted July 14, 2009 Share Posted July 14, 2009 Hey people, I'm nearly finishing this script but now a problem came up. If you run the script and select "About" from the tray a about box comes up and if you click close it disappears. If you click it for the second time it doesn't work anymore while the other parts of the script are still fully functional. expandcollapse popup#include <ButtonConstants.au3> #include <ComboConstants.au3> #Include <Constants.au3> #include <Date.au3> #include <EditConstants.au3> #Include <File.au3> #include <GUIConstantsEx.au3> #include <GUICtrlSetOnHover_UDF.au3> #Include <Misc.au3> #include <StaticConstants.au3> #include <Sound.au3> #include <WindowsConstants.au3> Opt ( "GUIResizeMode", 802 ) Opt ( "TrayMenuMode", 1 ) AdlibEnable ( "Updater", 1000 ) #Region Variables $Title = "AlarmClock" $IniDirectory = @MyDocumentsDir & "\AlarmClock.ini" $i = 0 $x = 0 $n = 0 $q = 0 $w = 0 $p = 0 $u = 0 #EndRegion $GUI = GUICreate ( $Title, 360, 345 ) ;65 ;345 #Region Options ///////////////////////////////////////////////////////////////////////////////////////////# GUICtrlCreateGroup ( "Time", 10, 70, 150, 48 ) GUICtrlCreateLabel ( "Play alarm at:", 23, 90 ) GUICtrlCreateLabel ( ":", 116, 90 ) $Hours = GUICtrlCreateInput ( "07", 95, 88, 20, 20, $ES_NUMBER ) $Minutes = GUICtrlCreateInput ( "30", 120, 88, 20, 20, $ES_NUMBER ) GUICtrlSetLimit ( $Hours, 2, 2 ) GUICtrlSetLimit ( $Minutes, 2, 2 ) GUICtrlSetTip ( $Hours, "Select a number in a range from 00 to 23.", "Hours", 1, 2 ) GUICtrlSetTip ( $Minutes, "Select a number in a range from 00 to 59.", "Minutes", 1, 2 ) GUICtrlCreateGroup ( "Alarm", 170, 70, 180, 48 ) $File = GUICtrlCreateInput ( "No file selected!", 183, 88, 100, 20, $ES_READONLY ) GUICtrlSetTip ( $File, GUICtrlRead ( $File ) ) $Browse = GUICtrlCreateButton ( "Browse", 285, 87, 50, 21 ) GUICtrlSetColor ( $File, 0xFF0000 ) GUICtrlCreateGroup ( "Days", 10, 128, 340, 48 ) $Mon = GUICtrlCreateCheckbox ( "Mon", 23, 146 ) $Tue = GUICtrlCreateCheckbox ( "Tue", 23*2+23, 146 ) $Wed = GUICtrlCreateCheckbox ( "Wed", 23*3+23*2, 146 ) $Thu = GUICtrlCreateCheckbox ( "Thu", 23*4+23*3, 146 ) $Fri = GUICtrlCreateCheckbox ( "Fri", 23*5+23*4, 146 ) $Sat = GUICtrlCreateCheckbox ( "Sat", 23*6+23*5, 146 ) $Sun = GUICtrlCreateCheckbox ( "Sun", 23*7+23*6, 146 ) GUICtrlCreateGroup ( "Repeat", 10, 185, 255, 48 ) GUICtrlCreateLabel ( "Repeat alarm every", 23, 205 ) $RepeatMin = GUICtrlCreateInput ( "5", 120, 203, 20, 20 ) GUICtrlSetLimit ( $RepeatMin, 2 ) $MLabel = GUICtrlCreateLabel ( " minutes for", 145, 205, 54 ) $RepeatNum = GUICtrlCreateInput ( "10", 202, 203, 20, 20 ) GUICtrlSetLimit ( $RepeatNum, 2 ) $TLabel = GUICtrlCreateLabel ( "times.", 226, 205 ) $SetAlarm = GUICtrlCreateButton ( "Set alarm", 270, 191, 80, 41 ) $SWW = GUICtrlCreateCheckbox ( "Start with Windows", 20, 238 ) $POP = GUICtrlCreateCheckbox ( "Pop-up on exit", 140, 238 ) $SaveOptions = GUICtrlCreateLabel ( "[Save options]", 263, 242.5 ) GUICtrlSetColor ( $SaveOptions, 0xC0C0C0 ) GUICtrlSetCursor( $SaveOptions, 0 ) _GUICtrl_SetOnHover ( $SaveOptions, "_Hover_Func", "_Hover_Func" ) GUICtrlCreateGroup ( "Volume", 10, 263, 200, 70 ) $VolumeSlider = GUICtrlCreateSlider ( 23, 305, 200-23*2+15, 20 ) $VolumeCheckbox = GUICtrlCreateCheckBox ( "Adjust volume to " & GUICtrlRead ( $VolumeSlider ) & " percent.", 25, 280, 180 ) GUICtrlCreateGroup ( "Snoozer", 220, 263, 130, 70 ) $SnoozeCombo = GUICtrlCreateCombo ( "1 minute", 233, 300, 100, 20, $CBS_DROPDOWNLIST ) GUICtrlSetData ( $SnoozeCombo, "2 minutes|3 minutes|4 minutes|5 minutes|6 minutes|7 minutes|8 minutes|9 minutes|10 minutes|30 minutes|60 minutes" ) GUICtrlCreateLabel ( "Snooze for", 233, 280, 70, 13 ) $SnoozeLabel = GUICtrlCreateLabel ( GUICtrlRead ( $SnoozeCombo ), 286, 280, 60, 12 ) #EndRegion #Region Dummy //////////////////////////////////////////////////////////////////////////////////////////////# $Hours2 = GUICtrlCreateLabel ( GUICtrlRead ( $Hours ), 10, 375 ) $Minutes2 = GUICtrlCreateLabel ( GUICtrlRead ( $Minutes ), 30, 375 ) $FileFullPath = GUICtrlCreateLabel ( GUICtrlRead ( $File ), 10, 395, 300, 30 ) $RepeatMin2 = GUICtrlCreateLabel ( GUICtrlRead ( $RepeatMin ), 10, 425 ) $RepeatNum2 = GUICtrlCreateLabel ( GUICtrlRead ( $RepeatNum ), 30, 425 ) #EndRegion #Region Changes from Ini ///////////////////////////////////////////////////////////////////////////////////# GUICtrlSetData ( $Hours, IniRead ( $IniDirectory, "Time", "Hours", "07" ) ) GUICtrlSetData ( $Minutes, IniRead ( $IniDirectory, "Time", "Minutes", "30" ) ) GUICtrlSetData ( $File, IniRead ( $IniDirectory, "File", "Name", "No file selected!" ) ) If IniRead ( $IniDirectory, "File", "Name", "No file selected!" ) = "No file selected!" Then GUICtrlSetColor ( $File, 0xFF0000 ) Else GUICtrlSetColor ( $File, 0x000000 ) EndIf Sleep ( 10 ) GUICtrlSetData ( $FileFullPath, IniRead ( $IniDirectory, "File", "Path", "No file selected!" ) ) GUICtrlSetState ( $Mon, IniRead ( $IniDirectory, "Days", "Mon", 1 ) ) GUICtrlSetState ( $Tue, IniRead ( $IniDirectory, "Days", "Tue", 1 ) ) GUICtrlSetState ( $Wed, IniRead ( $IniDirectory, "Days", "Wed", 1 ) ) GUICtrlSetState ( $Thu, IniRead ( $IniDirectory, "Days", "Thu", 1 ) ) GUICtrlSetState ( $Fri, IniRead ( $IniDirectory, "Days", "Fri", 1 ) ) GUICtrlSetState ( $Sat, IniRead ( $IniDirectory, "Days", "Sat", 4 ) ) GUICtrlSetState ( $Sun, IniRead ( $IniDirectory, "Days", "Sun", 4 ) ) GUICtrlSetData ( $RepeatMin, IniRead ( $IniDirectory, "Repeat", "Minutes", "5" ) ) GUICtrlSetData ( $RepeatNum, IniRead ( $IniDirectory, "Repeat", "Times", "3" ) ) GUICtrlSetState ( $VolumeCheckbox, IniRead ( $IniDirectory, "Volume", "Checkbox", 1 ) ) GUICtrlSetData ( $VolumeSlider, IniRead ( $IniDirectory, "Volume", "Slider", 50 ) ) GUICtrlSetData ( $SnoozeCombo, IniRead ( $IniDirectory, "Snooze", "Time", "5 minutes" ) ) If RegRead ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "AlarmClock" ) Then GUICtrlSetState ( $SWW, $GUI_CHECKED ) Else GUICtrlSetState ( $SWW, $GUI_UNCHECKED ) EndIf GUICtrlSetState ( $POP, IniRead ( $IniDirectory, "Options", "Popup", 4 ) ) #EndRegion #Region Base ///////////////////////////////////////////////////////////////////////////////////////////////# $ReadHours = GUICtrlRead ( $Hours ) $ReadMinutes = GUICtrlRead ( $Minutes ) $HeaderTimeInfoLabel = GUICtrlCreateLabel ( "Alarm set at:", 10, 10, 340, 15, $SS_CENTER ) $InformationLabel = GUICtrlCreateLabel ( $ReadHours & ":" & $ReadMinutes, 60, 23, 240, 30, $SS_CENTER ) $WinPos = WinGetPos ( $Title ) If $WinPos[3] = 91 Then $SettingsLabel = GUICtrlCreateLabel ( "Show Settings", 260, 41, 80, 15, $SS_RIGHT ) Else $SettingsLabel = GUICtrlCreateLabel ( "Hide Settings", 260, 41, 80, 15, $SS_RIGHT ) EndIf _GUICtrl_SetOnHover ( $SettingsLabel, "_Hover_Func", "_Hover_Func" ) GUICtrlSetFont ( $InformationLabel, 24, 400, "Arial" ) GUICtrlSetColor ( $SettingsLabel, 0xC0C0C0 ) GUICtrlSetCursor( $SettingsLabel, 0 ) #EndRegion GUICtrlSetState ( $FileFullPath, $GUI_FOCUS ) Updater() GUISetState ( @SW_SHOW ) #Region Tray Menu $Open = TrayCreateItem ( "Open " & $Title ) TrayCreateItem ( "" ) $MAlarm = TrayCreateItem ( "Alarm [" & GUICtrlRead ( $InformationLabel ) & "]" ) $MPopup = TrayCreateItem ( "Pop-up on exit", -1, -1, 1 ) $MAdVol = TrayCreateItem ( "Auto-adjust volume", -1, -1, 1 ) TrayCreateItem ( "" ) $About = TrayCreateItem ( "About" ) $Devart = TrayCreateItem ( "DeviantArt" ) TrayCreateItem ( "" ) $TExit = TrayCreateItem ( "Exit" ) TrayItemSetState ( $Open, $TRAY_DEFAULT ) TraySetClick ( 8 ) TraySetToolTip ( $Title ) #EndRegion While 1 $msg = GUIGetMsg() $traymsg = TrayGetMsg() Select Case $traymsg = $About About() Case $traymsg = $Devart ShellExecute ( "http://rawox.deviantart.com" ) Case $traymsg = $TExit Exit Case $traymsg = $Open $Size = WinGetClientSize ( $Title ) If $Size[1] = 345 Then GUICtrlSetData ( $SettingsLabel, "Show Settings" ) $Pos = WinGetPos ( $Title ) WinMove ( $Title, "", $Pos[0], $Pos[1]+140, $Pos[2], $Pos[3]-280 ) GUISetState ( @SW_SHOW ) Else GUISetState ( @SW_SHOW ) EndIf Case $msg = $SetAlarm If GUICtrlRead ( $File ) = "No file selected!" Then MsgBox ( 48, $Title, "You haven't selected an alarm!" ) Else If GUICtrlRead ( $SetAlarm ) = "Set alarm" Then GUICtrlSetData ( $SetAlarm, "Clear alarm" ) ElseIf GUICtrlRead ( $SetAlarm ) = "Clear alarm" Then GUICtrlSetData ( $SetAlarm, "Set Alarm" ) EndIf EndIf Case $msg = $GUI_EVENT_CLOSE GUISetState ( @SW_HIDE ) Case $msg = $SettingsLabel $Size = WinGetClientSize ( $Title ) If $Size[1] = 65 Then GUICtrlSetData ( $SettingsLabel, "Hide Settings" ) $Pos = WinGetPos ( $Title ) WinMove ( $Title, "", $Pos[0], $Pos[1]-140, $Pos[2], $Pos[3]+280 ) Else GUICtrlSetData ( $SettingsLabel, "Show Settings" ) $Pos = WinGetPos ( $Title ) WinMove ( $Title, "", $Pos[0], $Pos[1]+140, $Pos[2], $Pos[3]-280 ) EndIf Case $msg = $Browse $SoundFile = FileOpenDialog ( "Select alarm", "", "MP3 files (*.mp3)|WAV files (*.wav)|MID files (*.mid)", 3 ) If @error <> 1 Then GUICtrlSetColor ( $File, 0x000000 ) Dim $szDrive, $szDir, $szFName, $szExt _PathSplit ( $SoundFile, $szDrive, $szDir, $szFName, $szExt ) GUICtrlSetData ( $File, $szFName & $szExt ) GUICtrlSetData ( $FileFullPath, $SoundFile ) GUICtrlSetTip ( $File, GUICtrlRead ( $File ) ) GUICtrlSetState ( $MLabel, $GUI_FOCUS ) EndIf Case $msg = $SaveOptions If IsAdmin ( ) Then If GUICtrlRead ( $SWW ) = $GUI_CHECKED Then RegWrite ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "AlarmClock", "REG_SZ", @ScriptFullPath ) Else RegDelete ( "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "AlarmClock" ) EndIf Else If GUICtrlRead ( $SWW ) = $GUI_CHECKED Then GUICtrlSetState ( $SWW, $GUI_UNCHECKED ) IniWrite ( $IniDirectory, "Options", "Startup", GUICtrlRead ( $SWW ) ) MsgBox ( 64, "Admin rights required", "If you want to start " & $Title & " with Windows you'll need admin rights." & @CRLF & @CRLF & "When you're using Vista please right-click the executable, select 'run as administrator' and save your configuration again." ) EndIf EndIf IniWrite ( $IniDirectory, "Options", "Popup", GUICtrlRead ( $POP ) ) MsgBox ( 64, "Saved succesfull", "Your configuration has been saved." ) EndSelect WEnd Func Updater() #Region Header If GUICtrlRead ( $SetAlarm ) = "Clear alarm" Then GUICtrlSetData ( $HeaderTimeInfoLabel, "Alarm set at:" ) Else GUICtrlSetData ( $HeaderTimeInfoLabel, "Alarm not set, time:" ) EndIf #EndRegion #Region Alarm If GUICtrlRead ( $SetAlarm ) = "Clear Alarm" Then AlarmCheck() EndIf #EndRegion #Region Snoozer If GUICtrlRead ( $SnoozeCombo ) <> GUICtrlRead ( $SnoozeLabel ) Then GUICtrlSetData ( $SnoozeLabel, GUICtrlRead ( $SnoozeCombo ) ) EndIf #EndRegion #Region Volume If GUICtrlRead ( $VolumeCheckbox ) = $GUI_CHECKED Then GUICtrlSetState ( $VolumeSlider, $GUI_ENABLE ) Else GUICtrlSetState ( $VolumeSlider, $GUI_DISABLE ) EndIf GUICtrlSetData ( $VolumeCheckbox, "Adjust volume to " & GUICtrlRead ( $VolumeSlider ) & " percent." ) #EndRegion #Region Filename If GUICtrlRead ( $File ) = "" Then GUICtrlSetData ( $File, "No file selected!" ) GUICtrlSetColor ( $File, 0xFF0000 ) ElseIf GUICtrlRead ( $File ) = "No file selected!" Then GUICtrlSetColor ( $File, 0xFF0000 ) ElseIf $x = 2 Then GUICtrlSetColor ( $File, 0x000000 ) Else $x +=1 EndIf #EndRegion #Region Time If $i = 2 Then $ReadHours = GUICtrlRead ( $Hours ) $ReadMinutes = GUICtrlRead ( $Minutes ) $Read = GUICtrlRead ( $Hours ) $Read2 = GUICtrlRead ( $Hours2 ) $Read3 = GUICtrlRead ( $Minutes ) $Read4 = GUICtrlRead ( $Minutes2 ) If $Read <> $Read2 Then If $Read > 23 Then GUICtrlSetData ( $Hours, "23" ) ElseIf $Read = "" Then GUICtrlSetData ( $Hours, "00" ) ElseIf $Read = "0" Or $Read = "1" Or $Read = "2" Or $Read = "3" Or $Read = "4" Or $Read = "5" Or $Read = "6" Or $Read = "7" Or $Read = "8" Or $Read = "9" Then $Read = GUICtrlRead ( $Hours ) GUICtrlSetData ( $Hours, "0" & $Read ) EndIf $Read = GUICtrlRead ( $Hours ) GUICtrlSetData ( $Hours2, $Read ) GUICtrlSetData ( $InformationLabel, $Read & ":" & $ReadMinutes ) EndIf If $Read3 <> $Read4 Then If $Read3 > 59 Then GUICtrlSetData ( $Minutes, "59" ) ElseIf $Read3 = "" Then GUICtrlSetData ( $Minutes, "00" ) ElseIf $Read3 = "0" Or $Read3 = "1" Or $Read3 = "2" Or $Read3 = "3" Or $Read3 = "4" Or $Read3 = "5" Or $Read3 = "6" Or $Read3 = "7" Or $Read3 = "8" Or $Read3 = "9" Then $Read3 = GUICtrlRead ( $Minutes ) GUICtrlSetData ( $Minutes, "0" & $Read3 ) EndIf $Read3 = GUICtrlRead ( $Minutes ) GUICtrlSetData ( $Minutes2, $Read3 ) GUICtrlSetData ( $InformationLabel, $ReadHours & ":" & $Read3 ) EndIf $i = 0 Else $i += 1 EndIf #EndRegion #Region Repeat $ReadMin = GUICtrlRead ( $RepeatMin ) $ReadNum = GUICtrlRead ( $RepeatNum ) If $ReadMin <> GUICtrlRead ( $RepeatMin2 ) Then GUICtrlSetData ( $RepeatMin2, $ReadMin ) EndIf If $ReadNum <> GUICtrlRead ( $RepeatNum2 ) Then GUICtrlSetData ( $RepeatNum2, $ReadNum ) EndIf If $ReadNum < 2 Then GUICtrlSetState ( $RepeatMin, $GUI_DISABLE ) Else GUICtrlSetState ( $RepeatMin, $GUI_ENABLE ) EndIf If $ReadMin < 1 Then GUICtrlSetData ( $RepeatMin, 1 ) EndIf If $ReadNum < 1 Then GUICtrlSetData ( $RepeatNum, 1 ) EndIf #EndRegion #Region IniWrite IniWrite ( $IniDirectory, "Time", "Hours", GUICtrlRead ( $Hours ) ) IniWrite ( $IniDirectory, "Time", "Minutes", GUICtrlRead ( $Minutes ) ) IniWrite ( $IniDirectory, "File", "Name", GUICtrlRead ( $File ) ) IniWrite ( $IniDirectory, "File", "Path", GUICtrlRead ( $FileFullPath ) ) IniWrite ( $IniDirectory, "Days", "Mon", GUICtrlRead ( $Mon ) ) IniWrite ( $IniDirectory, "Days", "Tue", GUICtrlRead ( $Tue ) ) IniWrite ( $IniDirectory, "Days", "Wed", GUICtrlRead ( $Wed ) ) IniWrite ( $IniDirectory, "Days", "Thu", GUICtrlRead ( $Thu ) ) IniWrite ( $IniDirectory, "Days", "Fri", GUICtrlRead ( $Fri ) ) IniWrite ( $IniDirectory, "Days", "Sat", GUICtrlRead ( $Sat ) ) IniWrite ( $IniDirectory, "Days", "Sun", GUICtrlRead ( $Sun ) ) IniWrite ( $IniDirectory, "Repeat", "Minutes", GUICtrlRead ( $RepeatMin ) ) IniWrite ( $IniDirectory, "Repeat", "Times", GUICtrlRead ( $RepeatNum ) ) IniWrite ( $IniDirectory, "Volume", "Checkbox", GUICtrlRead ( $VolumeCheckbox ) ) IniWrite ( $IniDirectory, "Volume", "Slider", GUICtrlRead ( $VolumeSlider ) ) IniWrite ( $IniDirectory, "Snooze", "Time", GUICtrlRead ( $SnoozeCombo ) ) #EndRegion EndFunc Func AlarmCheck() If @HOUR = GUICtrlRead ( $Hours ) And @MIN = GUICtrlRead ( $Minutes ) Then If @WDAY = 1 And GUICtrlRead ( $Sun ) = $GUI_CHECKED Then Alarm() EndIf If @WDAY = 2 And GUICtrlRead ( $Mon ) = $GUI_CHECKED Then Alarm() EndIf If @WDAY = 3 And GUICtrlRead ( $Tue ) = $GUI_CHECKED Then Alarm() EndIf If @WDAY = 4 And GUICtrlRead ( $Wed ) = $GUI_CHECKED Then Alarm() EndIf If @WDAY = 5 And GUICtrlRead ( $Thu ) = $GUI_CHECKED Then Alarm() EndIf If @WDAY = 6 And GUICtrlRead ( $Fri ) = $GUI_CHECKED Then Alarm() EndIf If @WDAY = 7 And GUICtrlRead ( $Sat ) = $GUI_CHECKED Then Alarm() EndIf EndIf EndFunc Func Alarm() $p = 0 If Not WinExists ( "Wake up!" ) Then HotKeySet ( "{SPACE}", "Snoozer" ) HotKeySet ( "{ENTER}", "Stop" ) GUISetState ( $Title, @SW_HIDE ) Global $AlarmGUI = GUICreate ( "Wake up!", 420, 35, -1, -1, $DS_SETFOREGROUND ) GUISetStyle ( $WS_POPUPWINDOW, $WS_EX_TOPMOST ) GUISetState ( @SW_SHOW, $AlarmGUI ) Global $AlarmLabel = GUICtrlCreateLabel ( "Press Space to snooze the alarm and Enter to return to the main window.", 0, 10, 420, 20, $SS_CENTER ) Global $DAlarmLabel = GUICtrlCreateLabel ( GUICtrlRead ( $RepeatMin ), 0, 40, 420, 20, $SS_CENTER ) Global $DTimesLabel = GUICtrlCreateLabel ( GUICtrlRead ( $RepeatNum ), 0, 40, 30, 20, $SS_CENTER ) If GUICtrlRead ( $SnoozeCombo ) = "1 minute" Then $SnoozeComboNr = StringTrimRight ( GUICtrlRead ( $SnoozeCombo ), 7 ) Else $SnoozeComboNr = StringTrimRight ( GUICtrlRead ( $SnoozeCombo ), 8 ) EndIf Global $DSnoozeLabel = GUICtrlCreateLabel ( $SnoozeComboNr, 100, 40, 30, 20, $SS_CENTER ) WinSetOnTop ( "Wake up!", "", 1 ) If GUICtrlRead ( $VolumeCheckbox ) = $GUI_CHECKED Then SoundSetWaveVolume ( GUICtrlRead ( $VolumeSlider ) ) EndIf Global $Read = GUICtrlRead ( $FileFullPath ) Global $Song = _SoundOpen ( $Read ) _SoundPlay ( $Song, 0 ) Do $ReadTime = GUICtrlRead ( $RepeatMin ) If $p = $ReadTime*120 Then $Reader = GUICtrlRead ( $DTimesLabel ) GUICtrlSetData ( $DTimesLabel, $Reader - 1 ) $p = 0 _SoundStop ( $Song ) _SoundPlay ( $Song, 0 ) Else Sleep ( 500 ) $p += 1 EndIf Until GUICtrlRead ( $DTimesLabel ) = 0 EndIf EndFunc Func Snoozer() _SoundStop ( $Song ) GUICtrlSetData ( $AlarmLabel, "Alarm is snoozed for " & GUICtrlRead ( $DSnoozeLabel ) & " minutes. Press Enter to return to the main window." ) Do If $u = 20 Then $ReadDSnoozeLabel = GUICtrlRead ( $DSnoozeLabel ) GUICtrlSetData ( $DSnoozeLabel, $ReadDSnoozeLabel - 1 ) GUICtrlSetData ( $AlarmLabel, "Alarm is snoozed for " & GUICtrlRead ( $DSnoozeLabel ) & " minutes. Press Enter to return to the main window." ) $u = 0 Else Sleep ( 500 ) $u += 1 EndIf Until GUICtrlRead ( $DSnoozeLabel ) = 0 Or WinActive ( $Title ) If GUICtrlRead ( $SnoozeCombo ) = "1 minute" Then $SnoozeComboNr = StringTrimRight ( GUICtrlRead ( $SnoozeCombo ), 7 ) Else $SnoozeComboNr = StringTrimRight ( GUICtrlRead ( $SnoozeCombo ), 8 ) EndIf GUICtrlSetData ( $DSnoozeLabel, $SnoozeComboNr ) GUICtrlSetData ( $AlarmLabel, "Press Space to snooze the alarm and Enter to return to the main window." ) _SoundPlay ( $Song ) EndFunc Func Stop() HotKeySet ( "{ENTER}" ) HotKeySet ( "{SPACE}" ) _SoundStop ( $Song ) _SoundClose ( $Song ) GUIDelete ( $AlarmGUI ) GUICtrlSetData ( $SetAlarm, "Set alarm" ) GUISetState ( @SW_SHOW, $GUI ) AdlibEnable ( "Updater", 1000 ) EndFunc Func About() TraySetState ( 2 ) GUISetState ( @SW_HIDE, $GUI ) $about = GuiCreate ( "About " & $Title, 215, 150, -1, -1, BitOR ( $WS_CAPTION, $WS_SYSMENU ) ) GUICtrlCreateIcon ( @AutoItExe, -1 , 11, 11 ) GUICtrlCreateLabel ( $Title, 59 ,11 ,135 ,20 ) GUICtrlSetFont ( -1, 10, 800, 0, "Arial") GUICtrlCreateLabel ( "© 2007 - " & @YEAR & @CRLF & @CRLF & "Cas Cornelissen", 59, 30, 135, 40 ) GUICtrlSetFont ( -1, 8.5, 400, 0, "Arial") $email = GUICtrlCreateLabel ( "supercasje@gmail.com", 59, 72, 135, 15 ) GuiCtrlSetFont ( $email, 8.5, -1, 4 ) GuiCtrlSetColor ( $email, 0x0000ff ) GuiCtrlSetCursor( $email, 0 ) $www = GUICtrlCreateLabel ( "http://rawox.deviantart.com", 59, 87, 140, 15 ) GuiCtrlSetFont ( $www, 8.5, -1, 4 ) GuiCtrlSetColor ( $www, 0x0000ff ) GuiCtrlSetCursor ( $www, 0 ) $CloseAbout = GUICtrlCreateButton ( "Close", 65, 115, 75, 23, BitOr ( $GUI_SS_DEFAULT_BUTTON, $BS_DEFPUSHBUTTON ) ) GUICtrlSetState ( -1, $GUI_FOCUS ) GUISetState ( @SW_SHOW, $about ) While 1 Switch GUIGetMsg () Case $email Run ( @ComSpec & " /c " & 'start mailto:supercasje@gmail.com?subject=' & $Title, "", @SW_HIDE ) Case $www Run ( @ComSpec & " /c " & 'start http://rawox.deviantart.com', "", @SW_HIDE ) Case $GUI_EVENT_CLOSE GUIDelete ( $about ) TraySetState ( 1 ) ExitLoop Case $CloseAbout GUIDelete ( $about ) TraySetState ( 1 ) ExitLoop EndSwitch WEnd EndFunc Func exitprog() Exit EndFunc Func _Hover_Func ( $iCtrlID, $iParam ) Local $iLabel_Color = 0x000000 If $iParam = 2 Then $iLabel_Color = 0xC0C0C0 EndIf Switch $iCtrlID Case $SettingsLabel GUICtrlSetColor($iCtrlID, $iLabel_Color) Case $SaveOptions GUICtrlSetColor ( $iCtrlID, $iLabel_Color ) Case $Edit If GUICtrlRead($iCtrlID) <> $sEdit_Data Then GUICtrlSetData($iCtrlID, $sEdit_Data) EndSwitch EndFunc Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted July 14, 2009 Moderators Share Posted July 14, 2009 Rawox, $About = TrayCreateItem ( "About" ) ... $about = GuiCreate ( "About " & $Title,.................... If I were to remind you that AutoIt capitalises all variables, is that enough of a clue? M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Rawox Posted July 14, 2009 Author Share Posted July 14, 2009 Rawox, $About = TrayCreateItem ( "About" ) ... $about = GuiCreate ( "About " & $Title,.................... If I were to remind you that AutoIt capitalises all variables, is that enough of a clue? M23 Damn, I'm feeling stupid Thanks Melba, you rock! 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