Moderators SmOke_N Posted September 14, 2006 Moderators Share Posted September 14, 2006 (edited) thanx big.. i will be putting that in the program in later versions.. atm im worken on getten the gui to open a new gui menu so i can have it make an ini file, im also tryen to figure out how to get the time 2 on.Just make it a conditional statement, and create an new gui within a function call. The time... I used AdlibEnable() to check current time every 500 ms, and if it was different to update (ControlSetData()) a label (sunken ($SS_SUNKEN I believe)). Case $msg = $MenuButton _CreateNewGUI() oÝ÷ ØGb´ l¡.²%vIèÂz-¶^rV«{*.®ö«¦åzÁ¥¡¶¥Â+avºw-â¶Ç¥|GbØw«yªÞ²¡ûayÊ+yû§rبÂ7ök¬x"¨"ëazö«¦åz̨ºÇZjV®¶s`¤gVæ2ôFÆ$ÖævW" Æö6Âb33c¶7ÆBÒ7G&æu7ÆBuT7G&Å&VBb33c¶5FÖRÂb33³¢b33² bb33c¶7ÆE³ÒfwC³Ò2æBçBb33c¶7ÆE³ÒfwC³ÒôvWD÷W"õU"ð ÷"çBb33c¶7ÆE³%ÒfwC³ÒÔâ÷"çB7G&æuG&Õ&vBb33c¶7ÆE³5ÒÂ2fwC²4T2FVâð uT7G&Å6WDFFb33c¶5FÖRÂb33´7W'&VçBFÖRb33²fײ5$ÄbfײôvWD÷W"õU"fײb33³¢b33²fײÔâfײb33³¢b33²fײ4T2fײb33²b33²fײb33c´ÕÒ bõU"Òõ7vF6÷W"uT7G&Å&VBb33c¶6öÖ&õ³ÒæBÔâÒuT7G&Å&VBb33c¶6öÖ&õ³%ÒæBð b33c´ÕÒÒuT7G&Å&VBb33c¶6öÖ&õ³5ÒæB&DäBuT7G&Å&VBb33c¶4µ³ÒÂFVà FÆ$F6&ÆR vÆR&DäBuT7G&Å&VBb33c¶4µ³Ò ôÆ&Ò 6ÆVWS tVæ@ &ö6W746Æ÷6Rb33c¶B FÆ$Væ&ÆRb33µôFÆ$ÖævW"b33²Â VæD`¤VæDgVæ0¤gVæ2ôvWD÷W"b33c¶÷W" 7vF6b33c¶÷W 66R b33c´ÕÒÒb33µÒb33° &WGW&âb33c¶÷W 66R2Fò#0 b33c´ÕÒÒb33µÒb33° &WGW&âb33c¶÷W"Ò 66R b33c´ÕÒÒb33´Òb33° &WGW&â 66RFò b33c´ÕÒÒb33´Òb33° &WGW&âb33c¶÷W VæE7vF6¤VæDgVæ0¤gVæ2õ7vF6÷W"b33c¶÷W" 7vF6b33c¶÷W 66R bb33c´ÕÒÒb33´Òb33²FVà &WGW&â VÇ6P &WGW&â VæD` 66RFò bb33c´ÕÒÒb33µÒb33²FVà &WGW&âb33c¶÷W"² VÇ6P &WGW&âb33c¶÷W VæD` VæE7vF6¤VæDgVæI don't know how much of that you'll understand though. But just reference each step with the function it's using... the example is not working obviously, needs the rest of the script. Edited September 14, 2006 by SmOke_N 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. Link to comment Share on other sites More sharing options...
Golbez Posted September 14, 2006 Author Share Posted September 14, 2006 what am i doing wroung? i cant seem 2 get the button to get the setup gui 2 open i have them both in functions... this is what i thought u ment expandcollapse popupOpt("GUIOnEventMode", 1) #include <Date.au3> #include <GUIConstants.au3> _iniread() Global $sleephour, $sleepmin, $wakeuphour, $wakeupmin, $stop, $play, $voldn, $volup, $next, $previous, $Button2 _MainGUI() While 1 If @HOUR = $sleephour Then If @MIN = $sleepmin Then Send($stop, 0) EndIf If @HOUR = $wakeuphour Then If @MIN = $wakeupmin Then send($play, 0) EndIf $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button2 _SetupGUI() EndSelect sleep(200) WEnd Func _iniread() ;Other Global $timekey = "{del}" Global $endkey = "{end}" HotKeySet($endkey, "Terminate") HotKeySet($timekey, "GetTime") ;Time Global $sleephour = 17 Global $sleepmin = 29 Global $wakeuphour = 17 Global $wakeupmin = 30 Global $day = 0 Global $month = 0 ;Delays Global $sleep = 10 ;Keys Global $play = "^!{ins}" Global $stop = "^!{end}" Global $pause = "^!{home}" Global $volup = "^!{up}" Global $voldn = "^!{down}" Global $next = "^!{left}" Global $previous = "^!{right}" EndFunc Func _MainGUI() $Alarm = GUICreate("Golbez Alarm", 273, 209, 356, 216, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS)) GUISetBkColor(0xA0A0A4) GUICtrlCreateLabel("Time Gos here", 16, 8, 241, 41, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0x454545) $Button1 = GUICtrlCreateButton("Exit", 192, 168, 73, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetCursor ($Button1, 7) GUICtrlSetOnEvent(-1, "Terminate") $Button2 = GUICtrlCreateButton("Setup", 192, 128, 73, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") $Button3 = GUICtrlCreateButton("Play", 144, 128, 41, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays current song.") GUICtrlSetOnEvent(-1, "Play") $Button4 = GUICtrlCreateButton("Stop", 144, 168, 41, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Stops current song.") GUICtrlSetOnEvent(-1, "Stop") $Button5 = GUICtrlCreateButton("U", 200, 56, 25, 17, 0) $Button6 = GUICtrlCreateButton("U", 200, 88, 25, 17, 0) $Button7 = GUICtrlCreateButton("D", 240, 56, 25, 17, 0) $Button8 = GUICtrlCreateButton("D", 240, 88, 25, 17, 0) $Button9 = GUICtrlCreateButton("Previous", 8, 168, 65, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays previous song.") GUICtrlSetOnEvent(-1, "_Previous") $Button10 = GUICtrlCreateButton("Next", 8, 128, 65, 33) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays next song.") GUICtrlSetOnEvent(-1, "_Next") $Button11 = GUICtrlCreateButton("Vol Up", 80, 128, 57, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Turn volume up.") GUICtrlSetOnEvent(-1, "VolUp") $Button12 = GUICtrlCreateButton("Vol Dn", 80, 168, 57, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Turn volume down.") GUICtrlSetOnEvent(-1, "VolDown") GUICtrlCreateLabel("WakeUp time goes here", 16, 56, 175, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xA0A0A4) GUICtrlCreateLabel("Sleep time goes here", 16, 88, 175, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE,$SS_RIGHTJUST)) GUICtrlSetBkColor(-1, 0xA0A0A4) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $Alarm) EndFunc Func _SetupGUI() $Setup = GUICreate("Setup", 241, 175, 202, 116) GUICtrlCreateLabel("", 24, 24, 4, 4) $Radio1 = GUICtrlCreateRadio("Close Winamp after sleep alarm is triggered.", 8, 112, 225, 17, BitOR($BS_AUTORADIOBUTTON,$BS_LEFT)) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") $Button21 = GUICtrlCreateButton("Back to Alarm", 16, 136, 209, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUISetOnEvent($GUI_EVENT_CLOSE, "_MainGUI", $setup) $List1 = GUICtrlCreateList("", 24, 40, 81, 81) GUICtrlSetData(-1, " 5 minutes|10 minutes|15 minutes|20 minutes|25 minutes|30 minutes") GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") $Group1 = GUICtrlCreateGroup("Snooze Time", 16, 16, 97, 81, $BS_CENTER) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) EndFunc Func GetTime() MsgBox(48,"time", "hour is: " & @HOUR & " min is: " & @MIN & " sec is: " & @SEC, 5) MsgBox(48,"date", "month is: " & @MON & " day is: " & @WDAY & " year is: " & @YEAR, 5) EndFunc Func Play() Send($play) EndFunc Func Stop() Send($stop) EndFunc Func VolUp() Send($volup) EndFunc Func VolDown() Send($voldn) EndFunc Func _Next() Send($next) EndFunc Func _Previous() Send($previous) EndFunc Func Terminate() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 14, 2006 Moderators Share Posted September 14, 2006 You can't use OnEventMode with GUIGetMsg() 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. Link to comment Share on other sites More sharing options...
Golbez Posted September 14, 2006 Author Share Posted September 14, 2006 (edited) ok well i got it 2 work.. Edited September 14, 2006 by Golbez Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 14, 2006 Moderators Share Posted September 14, 2006 i no u hate doen this but u think u can do it for me.. i really have no clue how 2 do the guis.. im usen koda to make them and hopen it works..Nope, but thanks for politely asking ... If I do it, you'll never learn, I've told you what your issue is, now over come it. 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. Link to comment Share on other sites More sharing options...
Golbez Posted September 14, 2006 Author Share Posted September 14, 2006 how do i get it so if the user click the close button or the X in the top right it does not close the program... just the menu... i cant figure it out.. current code: expandcollapse popup;Opt("GUIOnEventMode", 1) #include <Date.au3> #include <GUIConstants.au3> _iniread() Global $sleephour, $sleepmin, $wakeuphour, $wakeupmin, $stop, $play, $voldn, $volup, $next, $previous, $Button2, $setup, $close _MainGUI() While 1 If @HOUR = $sleephour Then If @MIN = $sleepmin Then Send($stop, 0) EndIf If @HOUR = $wakeuphour Then If @MIN = $wakeupmin Then send($play, 0) EndIf $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE If $close = 0 Then ExitLoop Case $msg = $Button2 _SetupGUI() EndSelect sleep(200) WEnd Func _iniread() ;Other Global $timekey = "{del}" Global $endkey = "{end}" HotKeySet($endkey, "Terminate") HotKeySet($timekey, "GetTime") ;Time Global $sleephour = 17 Global $sleepmin = 29 Global $wakeuphour = 17 Global $wakeupmin = 30 Global $day = 0 Global $month = 0 ;Delays Global $sleep = 10 ;Keys Global $play = "^!{ins}" Global $stop = "^!{end}" Global $pause = "^!{home}" Global $volup = "^!{up}" Global $voldn = "^!{down}" Global $next = "^!{left}" Global $previous = "^!{right}" EndFunc Func _MainGUI() $close = 0 $Alarm = GUICreate("Golbez Alarm", 273, 209, 356, 216, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS)) GUISetBkColor(0xA0A0A4) GUICtrlCreateLabel("Time Gos here", 16, 8, 241, 41, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0x454545) $Button1 = GUICtrlCreateButton("Exit", 192, 168, 73, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetCursor ($Button1, 7) GUICtrlSetOnEvent(-1, "Terminate") $Button2 = GUICtrlCreateButton("Setup", 192, 128, 73, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") $Button3 = GUICtrlCreateButton("Play", 144, 128, 41, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays current song.") GUICtrlSetOnEvent(-1, "Play") $Button4 = GUICtrlCreateButton("Stop", 144, 168, 41, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Stops current song.") GUICtrlSetOnEvent(-1, "Stop") $Button5 = GUICtrlCreateButton("U", 200, 56, 25, 17, 0) $Button6 = GUICtrlCreateButton("U", 200, 88, 25, 17, 0) $Button7 = GUICtrlCreateButton("D", 240, 56, 25, 17, 0) $Button8 = GUICtrlCreateButton("D", 240, 88, 25, 17, 0) $Button9 = GUICtrlCreateButton("Previous", 8, 168, 65, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays previous song.") GUICtrlSetOnEvent(-1, "_Previous") $Button10 = GUICtrlCreateButton("Next", 8, 128, 65, 33) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays next song.") GUICtrlSetOnEvent(-1, "_Next") $Button11 = GUICtrlCreateButton("Vol Up", 80, 128, 57, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Turn volume up.") GUICtrlSetOnEvent(-1, "VolUp") $Button12 = GUICtrlCreateButton("Vol Dn", 80, 168, 57, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Turn volume down.") GUICtrlSetOnEvent(-1, "VolDown") GUICtrlCreateLabel("WakeUp time goes here", 16, 56, 175, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xA0A0A4) GUICtrlCreateLabel("Sleep time goes here", 16, 88, 175, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE,$SS_RIGHTJUST)) GUICtrlSetBkColor(-1, 0xA0A0A4) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $Alarm) EndFunc Func _SetupGUI() $close = 1 GUISwitch($setup) $setup = GUICreate("Setup", 241, 175, 202, 116) GUICtrlCreateLabel("", 24, 24, 4, 4) $Radio1 = GUICtrlCreateRadio("Close Winamp after sleep alarm is triggered.", 8, 112, 225, 17, BitOR($BS_AUTORADIOBUTTON,$BS_LEFT)) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") $Button21 = GUICtrlCreateButton("Back to Alarm", 16, 136, 209, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUISetOnEvent($GUI_EVENT_CLOSE, "_MainGUI", $setup) $List1 = GUICtrlCreateList("", 24, 40, 81, 81) GUICtrlSetData(-1, " 5 minutes|10 minutes|15 minutes|20 minutes|25 minutes|30 minutes") GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") $Group1 = GUICtrlCreateGroup("Snooze Time", 16, 16, 97, 81, $BS_CENTER) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) EndFunc Func GetTime() MsgBox(48,"time", "hour is: " & @HOUR & " min is: " & @MIN & " sec is: " & @SEC, 5) MsgBox(48,"date", "month is: " & @MON & " day is: " & @WDAY & " year is: " & @YEAR, 5) EndFunc Func Play() Send($play) EndFunc Func Stop() Send($stop) EndFunc Func VolUp() Send($volup) EndFunc Func VolDown() Send($voldn) EndFunc Func _Next() Send($next) EndFunc Func _Previous() Send($previous) EndFunc Func Terminate() Exit 0 EndFunc Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 14, 2006 Moderators Share Posted September 14, 2006 What is the "menu"? If it has a hwnd then just GUIDelete($Hwnd) ... Return 1, that way it deletes the child "menu" assumption here... and returns back to the regular one (main one). 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. Link to comment Share on other sites More sharing options...
Golbez Posted September 14, 2006 Author Share Posted September 14, 2006 can u not use abreavations? idk what u mean by "hwnd" Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 14, 2006 Moderators Share Posted September 14, 2006 The current GUICreate() ID... $hWnd = GUICreate() ... $hWnd carries the handle for that GUICreate()... so if you do GUIDelete($hWnd) in a condition statement, it will delete the current GUI. 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. Link to comment Share on other sites More sharing options...
Golbez Posted September 14, 2006 Author Share Posted September 14, 2006 (edited) ok i got it.. 2 problems that i cant find... for some reason it takes years to open the setup gui. the second is when the setup gui is open and i click the button to go back to the main gui it doesnt open the main gui it just opens the setup gui again edit: for some reason it flashes and the exit button dont work 4 some reason code update: expandcollapse popup#include <Date.au3> #include <GUIConstants.au3> _iniread() Global $sleephour, $sleepmin, $wakeuphour, $wakeupmin, $stop, $play, $voldn, $volup, $next, $previous, $Button2, $Button21, $setup, $close, $main _MainGUI() While 1 If @HOUR = $sleephour Then If @MIN = $sleepmin Then Send($stop, 0) EndIf If @HOUR = $wakeuphour Then If @MIN = $wakeupmin Then send($play, 0) EndIf $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Button2 GUIDelete($Main) _SetupGUI() Case $msg = $Button21 GUIDelete($setup) _MainGUI() EndSelect sleep(200) WEnd Func _iniread() ;Other Global $timekey = "{del}" Global $endkey = "{end}" HotKeySet($endkey, "Terminate") HotKeySet($timekey, "GetTime") ;Time Global $sleephour = 17 Global $sleepmin = 29 Global $wakeuphour = 17 Global $wakeupmin = 30 Global $day = 0 Global $month = 0 ;Delays Global $sleep = 10 ;Keys Global $play = "^!{ins}" Global $stop = "^!{end}" Global $pause = "^!{home}" Global $volup = "^!{up}" Global $voldn = "^!{down}" Global $next = "^!{left}" Global $previous = "^!{right}" EndFunc Func _MainGUI() $Main = GUICreate("Golbez Alarm", 273, 209, 356, 216, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS)) GUISetBkColor(0xA0A0A4) GUICtrlCreateLabel("Time Gos here", 16, 8, 241, 41, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0x454545) $Button1 = GUICtrlCreateButton("Exit", 192, 168, 73, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetCursor ($Button1, 7) GUICtrlSetOnEvent(-1, "Terminate") $Button2 = GUICtrlCreateButton("Setup", 192, 128, 73, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") $Button3 = GUICtrlCreateButton("Play", 144, 128, 41, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays current song.") GUICtrlSetOnEvent(-1, "Play") $Button4 = GUICtrlCreateButton("Stop", 144, 168, 41, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Stops current song.") GUICtrlSetOnEvent(-1, "Stop") $Button5 = GUICtrlCreateButton("U", 200, 56, 25, 17, 0) $Button6 = GUICtrlCreateButton("U", 200, 88, 25, 17, 0) $Button7 = GUICtrlCreateButton("D", 240, 56, 25, 17, 0) $Button8 = GUICtrlCreateButton("D", 240, 88, 25, 17, 0) $Button9 = GUICtrlCreateButton("Previous", 8, 168, 65, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays previous song.") GUICtrlSetOnEvent(-1, "_Previous") $Button10 = GUICtrlCreateButton("Next", 8, 128, 65, 33) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays next song.") GUICtrlSetOnEvent(-1, "_Next") $Button11 = GUICtrlCreateButton("Vol Up", 80, 128, 57, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Turn volume up.") GUICtrlSetOnEvent(-1, "VolUp") $Button12 = GUICtrlCreateButton("Vol Dn", 80, 168, 57, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Turn volume down.") GUICtrlSetOnEvent(-1, "VolDown") GUICtrlCreateLabel("WakeUp time goes here", 16, 56, 175, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xA0A0A4) GUICtrlCreateLabel("Sleep time goes here", 16, 88, 175, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE,$SS_RIGHTJUST)) GUICtrlSetBkColor(-1, 0xA0A0A4) GUISetState(@SW_SHOW) ;GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $Main) EndFunc Func _SetupGUI() $Setup = GUICreate("Setup", 241, 161, 500, 138) GUISetFont(8, 400, 0, "Comic Sans MS") GUICtrlCreateLabel("", 32, 0, 4, 4) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") $Button21 = GUICtrlCreateButton("Back to Main Menu", 16, 120, 209, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") $Group1 = GUICtrlCreateGroup("Snooze Time", 16, 8, 97, 87, $BS_CENTER) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlCreateGroup("", -99, -99, 1, 1) $List1 = GUICtrlCreateList("", 24, 19, 81, 96, $WS_VSCROLL, $WS_EX_STATICEDGE) GUICtrlSetData(-1, " 5 Minutes|10 Minutes|15 Minutes|20 Minutes|25 Minutes|30 Minutes") GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") $Checkbox1 = GUICtrlCreateCheckbox("Close Winamp after sleep alarm is triggered", 8, 96, 225, 17) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUISetState(@SW_SHOW) EndFunc Func GetTime() MsgBox(48,"time", "hour is: " & @HOUR & " min is: " & @MIN & " sec is: " & @SEC, 5) MsgBox(48,"date", "month is: " & @MON & " day is: " & @WDAY & " year is: " & @YEAR, 5) EndFunc Func Play() Send($play) EndFunc Func Stop() Send($stop) EndFunc Func VolUp() Send($volup) EndFunc Func VolDown() Send($voldn) EndFunc Func _Next() Send($next) EndFunc Func _Previous() Send($previous) EndFunc Func Terminate() Exit 0 EndFunc Edited September 14, 2006 by Golbez Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 14, 2006 Moderators Share Posted September 14, 2006 (edited) Maybe this will give you an idea on how to merge the 2expandcollapse popupOpt('GUIONEVENTMODE', 1) Global $MAINBUTTON, $MAINGUI _MainGUI() Func _MainGUI() $MAINGUI = GUICreate('MY MAIN GUI', 200, 100) $MAINBUTTON = GUICtrlCreateButton('SWITCH TO SUB GUI', 35, 35, 125, 30) GUISetOnEvent(-3, '_EXITNOW') GUICtrlSetOnEvent($MAINBUTTON, '_MAINEVENTS') GUISetState() While 1 Sleep(1000) WEnd EndFunc Func _MAINEVENTS() Switch @GUI_CtrlId Case $MAINBUTTON GUISetState(@SW_HIDE, HWnd($MAINGUI)) Opt('GUIONEVENTMODE', _SUBGUI()) GUISetState(@SW_SHOW, HWnd($MAINGUI)) EndSwitch EndFunc Func _SUBGUI() $OptGOEM = Opt('GUIONEVENTMODE', 0) $SUBGUI = GUICreate('MY SUB GUI', 200, 100) $SUBBUTTON = GUICtrlCreateButton('SWITCH TO MAIN GUI', 35, 35, 125, 30) GUISetState(@SW_SHOW, $SUBGUI) While 1 Switch GUIGetMsg() Case - 3 GUIDelete(HWnd($SUBGUI)) Return $OptGOEM Case $SUBBUTTON GUIDelete(HWnd($SUBGUI)) Return $OptGOEM EndSwitch WEnd EndFunc Func _EXITNOW() Exit EndFunc Edit: OOPS!, forgot a function Edited September 14, 2006 by SmOke_N 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. Link to comment Share on other sites More sharing options...
Golbez Posted September 14, 2006 Author Share Posted September 14, 2006 Opt('GUIONEVENTMODE', 1) u told me i cant use this!!!!!!! Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 14, 2006 Moderators Share Posted September 14, 2006 Opt('GUIONEVENTMODE', 1) u told me i cant use this!!!!!!!No I said you couldn't use the 2 together, ... the exception is coding around it, as I've showed you above how to do. 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. Link to comment Share on other sites More sharing options...
Golbez Posted September 14, 2006 Author Share Posted September 14, 2006 (edited) xD fine xD question.. does that whole thing just like if the button is pressed it turns the events off and when the next gui is loaded it turns it back on? Edited September 14, 2006 by Golbez Link to comment Share on other sites More sharing options...
Golbez Posted September 14, 2006 Author Share Posted September 14, 2006 (edited) I LOVE U SSMOKE!!!!!!!!!!!!!!!!!!!!!!!!!!!!! now 2 get this take time thing to work.... question whats the commands i should use 2 put it on the gui.. thats my problem of how 2 get it on.. i think i no how 2 do it tho updated code: expandcollapse popupOpt('GUIONEVENTMODE', 1) #include <Date.au3> #include <GUIConstants.au3> _iniread() Global $sleephour, $sleepmin, $wakeuphour, $wakeupmin, $stop, $play, $voldn, $volup, $next, $previous, $Setup, $close, $main Global $Button1, $Button2, $Button21, $Button3, $Button4, $Button9, $Button10, $Button11, $Button12 _MainGUI() Func _MainGUI() $Main = GUICreate("Golbez Alarm", 273, 209, 356, 216, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS)) GUISetBkColor(0xA0A0A4) GUICtrlCreateLabel("Time Gos here", 16, 8, 241, 41, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0x454545) $Button1 = GUICtrlCreateButton("Exit", 192, 168, 73, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetCursor ($Button1, 7) GUICtrlSetOnEvent(-1, "Terminate") $Button2 = GUICtrlCreateButton("Setup", 192, 128, 73, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUISetOnEvent(-3, 'Terminate') GUICtrlSetOnEvent($Button2, '_MAINEVENTS') GUISetState() $Button3 = GUICtrlCreateButton("Play", 144, 128, 41, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays current song.") GUICtrlSetOnEvent(-1, "Play") $Button4 = GUICtrlCreateButton("Stop", 144, 168, 41, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Stops current song.") GUICtrlSetOnEvent(-1, "Stop") $Button5 = GUICtrlCreateButton("U", 200, 56, 25, 17, 0) $Button6 = GUICtrlCreateButton("U", 200, 88, 25, 17, 0) $Button7 = GUICtrlCreateButton("D", 240, 56, 25, 17, 0) $Button8 = GUICtrlCreateButton("D", 240, 88, 25, 17, 0) $Button9 = GUICtrlCreateButton("Previous", 8, 168, 65, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays previous song.") GUICtrlSetOnEvent(-1, "_Previous") $Button10 = GUICtrlCreateButton("Next", 8, 128, 65, 33) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays next song.") GUICtrlSetOnEvent(-1, "_Next") $Button11 = GUICtrlCreateButton("Vol Up", 80, 128, 57, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Turn volume up.") GUICtrlSetOnEvent(-1, "VolUp") $Button12 = GUICtrlCreateButton("Vol Dn", 80, 168, 57, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Turn volume down.") GUICtrlSetOnEvent(-1, "VolDown") GUICtrlCreateLabel("WakeUp time goes here", 16, 56, 175, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xA0A0A4) GUICtrlCreateLabel("Sleep time goes here", 16, 88, 175, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE,$SS_RIGHTJUST)) GUICtrlSetBkColor(-1, 0xA0A0A4) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $Main) While 1 Sleep(1000) WEnd EndFunc Func _MAINEVENTS() Switch @GUI_CtrlId Case $Button2 GUISetState(@SW_HIDE, HWnd($Main)) Opt('GUIONEVENTMODE', _SetupGUI()) GUISetState(@SW_SHOW, HWnd($Main)) EndSwitch EndFunc Func _SetupGUI() $OptGOEM = Opt('GUIONEVENTMODE', 0) $Setup = GUICreate("Setup", 241, 161, 500, 138) GUISetFont(8, 400, 0, "Comic Sans MS") GUICtrlCreateLabel("", 32, 0, 4, 4) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") $Button21 = GUICtrlCreateButton("Back to Main Menu", 16, 120, 209, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUISetState(@SW_SHOW, $Setup) $Group1 = GUICtrlCreateGroup("Snooze Time", 16, 8, 97, 87, $BS_CENTER) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlCreateGroup("", -99, -99, 1, 1) $List1 = GUICtrlCreateList("", 24, 19, 81, 96, $WS_VSCROLL, $WS_EX_STATICEDGE) GUICtrlSetData(-1, " 5 Minutes|10 Minutes|15 Minutes|20 Minutes|25 Minutes|30 Minutes") GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") $Checkbox1 = GUICtrlCreateCheckbox("Close Winamp after sleep alarm is triggered", 8, 96, 225, 17) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case - 3 GUIDelete(HWnd($Setup)) Return $OptGOEM Case $Button21 GUIDelete(HWnd($Setup)) Return $OptGOEM EndSwitch WEnd EndFunc Func _iniread() ;Other Global $timekey = "{del}" Global $endkey = "{end}" HotKeySet($endkey, "Terminate") HotKeySet($timekey, "GetTime") ;Time Global $sleephour = 17 Global $sleepmin = 29 Global $wakeuphour = 17 Global $wakeupmin = 30 Global $day = 0 Global $month = 0 ;Delays Global $sleep = 10 ;Keys Global $play = "^!{ins}" Global $stop = "^!{end}" Global $pause = "^!{home}" Global $volup = "^!{up}" Global $voldn = "^!{down}" Global $next = "^!{left}" Global $previous = "^!{right}" EndFunc Func GetTime() MsgBox(48,"time", "hour is: " & @HOUR & " min is: " & @MIN & " sec is: " & @SEC, 5) MsgBox(48,"date", "month is: " & @MON & " day is: " & @WDAY & " year is: " & @YEAR, 5) EndFunc Func Play() Send($play) EndFunc Func Stop() Send($stop) EndFunc Func VolUp() Send($volup) EndFunc Func VolDown() Send($voldn) EndFunc Func _Next() Send($next) EndFunc Func _Previous() Send($previous) EndFunc Func CloseSetup() GUIDelete($Setup) EndFunc Func Terminate() Exit EndFunc Edited September 14, 2006 by Golbez Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 14, 2006 Moderators Share Posted September 14, 2006 (edited) 2 Things: 1. I said quit declaring variables within a function global 2. I have no idea what your question is Edited September 14, 2006 by SmOke_N 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. Link to comment Share on other sites More sharing options...
Golbez Posted September 14, 2006 Author Share Posted September 14, 2006 (edited) http://www.autoitscript.com/forum/index.ph...st&id=10880how did u put the time under the "current time" thats my question.. like what did u use 2 put it there i dont get that part... i no its not a button or anythin but i dont no what u used 2 put it there.. thats my questionexpandcollapse popupOpt('GUIONEVENTMODE', 1) #include <Date.au3> #include <GUIConstants.au3> _iniread() Global $sleephour, $sleepmin, $wakeuphour, $wakeupmin, $stop, $play, $voldn, $volup, $next, $previous, $Setup, $close, $main Global $Button1, $Button2, $Button21, $Button3, $Button4, $Button9, $Button10, $Button11, $Button12 _MainGUI() Func _MainGUI() $Main = GUICreate("Golbez Alarm", 273, 209, 356, 216, BitOR($WS_MAXIMIZEBOX,$WS_MINIMIZEBOX,$WS_SYSMENU,$WS_CAPTION,$WS_POPUPWINDOW,$WS_GROUP,$WS_TABSTOP,$WS_BORDER,$WS_CLIPSIBLINGS)) GUISetBkColor(0xA0A0A4) GUICtrlCreateLabel("Time Gos here", 16, 8, 241, 41, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0x454545) $Button1 = GUICtrlCreateButton("Exit", 192, 168, 73, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetCursor ($Button1, 7) GUICtrlSetOnEvent(-1, "Terminate") $Button2 = GUICtrlCreateButton("Setup", 192, 128, 73, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUISetOnEvent(-3, 'Terminate') GUICtrlSetOnEvent($Button2, '_MAINEVENTS') GUISetState() $Button3 = GUICtrlCreateButton("Play", 144, 128, 41, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays current song.") GUICtrlSetOnEvent(-1, "Play") $Button4 = GUICtrlCreateButton("Stop", 144, 168, 41, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Stops current song.") GUICtrlSetOnEvent(-1, "Stop") $Button5 = GUICtrlCreateButton("U", 200, 56, 25, 17, 0) $Button6 = GUICtrlCreateButton("U", 200, 88, 25, 17, 0) $Button7 = GUICtrlCreateButton("D", 240, 56, 25, 17, 0) $Button8 = GUICtrlCreateButton("D", 240, 88, 25, 17, 0) $Button9 = GUICtrlCreateButton("Previous", 8, 168, 65, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays previous song.") GUICtrlSetOnEvent(-1, "_Previous") $Button10 = GUICtrlCreateButton("Next", 8, 128, 65, 33) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Plays next song.") GUICtrlSetOnEvent(-1, "_Next") $Button11 = GUICtrlCreateButton("Vol Up", 80, 128, 57, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Turn volume up.") GUICtrlSetOnEvent(-1, "VolUp") $Button12 = GUICtrlCreateButton("Vol Dn", 80, 168, 57, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlSetTip(-1, "Turn volume down.") GUICtrlSetOnEvent(-1, "VolDown") GUICtrlCreateLabel("WakeUp time goes here", 16, 56, 175, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE)) GUICtrlSetBkColor(-1, 0xA0A0A4) GUICtrlCreateLabel("Sleep time goes here", 16, 88, 175, 17, BitOR($SS_CENTER,$SS_CENTERIMAGE,$SS_RIGHTJUST)) GUICtrlSetBkColor(-1, 0xA0A0A4) GUISetState(@SW_SHOW) GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate", $Main) While 1 Sleep(1000) WEnd EndFunc Func _MAINEVENTS() Switch @GUI_CtrlId Case $Button2 GUISetState(@SW_HIDE, HWnd($Main)) Opt('GUIONEVENTMODE', _SetupGUI()) GUISetState(@SW_SHOW, HWnd($Main)) EndSwitch EndFunc Func _SetupGUI() $OptGOEM = Opt('GUIONEVENTMODE', 0) $Setup = GUICreate("Setup", 241, 161, 360, 216) GUISetFont(8, 400, 0, "Comic Sans MS") GUICtrlCreateLabel("", 32, 0, 4, 4) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") $Button21 = GUICtrlCreateButton("Back to Main Menu", 16, 120, 209, 33, 0) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUISetState(@SW_SHOW, $Setup) $Group1 = GUICtrlCreateGroup("Snooze Time", 16, 8, 97, 87, $BS_CENTER) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUICtrlCreateGroup("", -99, -99, 1, 1) $List1 = GUICtrlCreateList("", 24, 19, 81, 96, $WS_VSCROLL, $WS_EX_STATICEDGE) GUICtrlSetData(-1, " 5 Minutes|10 Minutes|15 Minutes|20 Minutes|25 Minutes|30 Minutes") GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") $Checkbox1 = GUICtrlCreateCheckbox("Close Winamp after sleep alarm is triggered", 8, 96, 225, 17) GUICtrlSetFont(-1, 8, 400, 0, "Comic Sans MS") GUISetState(@SW_SHOW) While 1 Switch GUIGetMsg() Case - 3 GUIDelete(HWnd($Setup)) Return $OptGOEM Case $Button21 GUIDelete(HWnd($Setup)) Return $OptGOEM EndSwitch WEnd EndFunc Func _iniread() ;Other $timekey = "{del}" $endkey = "{end}" HotKeySet($endkey, "Terminate") HotKeySet($timekey, "GetTime") ;Time $sleephour = 17 $sleepmin = 29 $wakeuphour = 17 $wakeupmin = 30 $day = 0 $month = 0 ;Delays $sleep = 10 ;Keys $play = "^!{ins}" $stop = "^!{end}" $pause = "^!{home}" $volup = "^!{up}" $voldn = "^!{down}" $next = "^!{left}" $previous = "^!{right}" EndFunc Func GetTime() MsgBox(48,"time", "hour is: " & @HOUR & " min is: " & @MIN & " sec is: " & @SEC, 5) MsgBox(48,"date", "month is: " & @MON & " day is: " & @WDAY & " year is: " & @YEAR, 5) EndFunc Func Play() Send($play) EndFunc Func Stop() Send($stop) EndFunc Func VolUp() Send($volup) EndFunc Func VolDown() Send($voldn) EndFunc Func _Next() Send($next) EndFunc Func _Previous() Send($previous) EndFunc Func CloseSetup() GUIDelete($Setup) EndFunc Func Terminate() Exit EndFunc i no i got to use this later on but idk what command or commands to use to put the time on to the gui menu.expandcollapse popupFunc _AdlibManager() Local $aSplit = StringSplit(GUICtrlRead($iCTime), ':') If $aSplit[0] >= 3 And (Int($aSplit[1]) >= _GetHour(@HOUR) _ Or Int($aSplit[2]) >= @MIN Or Int(StringTrimRight($aSplit[3], 3)) > @SEC) Then _ GUICtrlSetData($iCTime, 'Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM) If @HOUR = _SwitchHour(GUICtrlRead($iCombo[1])) And @MIN = GUICtrlRead($iCombo[2]) And _ $AMPM = GUICtrlRead($iCombo[3]) And BitAND(GUICtrlRead($iCHK[1]), 1) Then AdlibDisable() While BitAND(GUICtrlRead($iCHK[1]), 1) _Alarm() Sleep(500) WEnd ProcessClose($iPid) AdlibEnable('_AdlibManager', 100) EndIf EndFunc Func _GetHour($iHour) Switch $iHour Case 12 $AMPM = 'PM' Return $iHour Case 13 To 23 $AMPM = 'PM' Return $iHour - 12 Case 0 $AMPM = 'AM' Return 12 Case 1 To 11 $AMPM = 'AM' Return $iHour EndSwitch EndFunc Func _SwitchHour($iHour) Switch $iHour Case 12 If $AMPM = 'AM' Then Return 0 Else Return 12 EndIf Case 1 To 11 If $AMPM = 'PM' Then Return $iHour + 12 Else Return $iHour EndIf EndSwitch EndFuncthanx for all u help u taught me a bunch so far Edited September 14, 2006 by Golbez Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 14, 2006 Moderators Share Posted September 14, 2006 My _AdlibManager() function shows you actually I believe. GUICtrlSetData($iCTime, 'Current Time' & @CRLF & _GetHour(@HOUR) & ':' & @MIN & ':' & @SEC & ' ' & $AMPM)See the @CRLF? 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. Link to comment Share on other sites More sharing options...
Golbez Posted September 14, 2006 Author Share Posted September 14, 2006 (edited) ok now how do i get that 2 put the time on there... i get that it changes and sets the data n all but i cant get it 2 place the current time.. btw my head starten 2 hurt edit: just found this command ima play wit it a lil bit. GUICtrlCreateDate ( "text", left, top [, width [, height [, style [, exStyle]]]] edit2: yeah thats not it and my head hurten even more because im so confused xD Edited September 14, 2006 by Golbez Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted September 14, 2006 Moderators Share Posted September 14, 2006 I think I've given you a pretty good start personally... I've showed you how to get the current time and how to put it in there with the 3 functions I provided. You need to take a step forward and just work it out... you're close to getting it, but you nly try things for 2 or 3 minutes before you post here for help. Do it for 2 or 3 hours lol. 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. 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