Jump to content

save\reload gui


Moshelog
 Share

Recommended Posts

If I understand correctly, I'm experiencing the same type of problem.

I created a GUI for my daily alarm clock script, but I haven't figured out how to really make the GUI interact with the script, you know, by changing what is assigned to each variable.

It'd also be nice if I could get the GUI to minimize to the tray when I click "Ok" to save settings and "Cancel" to have everything reset.

Thanks.

Link to comment
Share on other sites

Thank you, but that's not quite what I was trying to do. It's very similar, and I think you pointed me the right direction.

I want the GUI to update the variables in the script and the close the GUI and have the script finish executing.

Here's my GUI code do far:

#include <ButtonConstants.au3>
    #include <ComboConstants.au3>
    #include <EditConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <SliderConstants.au3>
    #include <StaticConstants.au3>
    #include <WindowsConstants.au3>
    Opt("GUIOnEventMode", 1)
    #Region ### START Koda GUI section ### Form=C:\Users\Jason\Documents\AutoIt\tuts\practiceFiles\AlarmClock.kxf
    $AlarmClock = GUICreate("Alarm Clock", 541, 359, 1116, 214)
    GUISetIcon("D:\003.ico")
    $GroupBox1 = GUICtrlCreateGroup("", 8, 1, 521, 318)
    $desiredVolume = GUICtrlCreateSlider(9, 263, 517, 45)
    GUICtrlSetLimit($desiredVolume, 200, 0)
    $Vol = GUICtrlCreateLabel("Volume", 14, 237, 70, 28)
    GUICtrlSetFont($Vol, 16, 400, 0, "MS Sans Serif")
    $alarmHour = GUICtrlCreateCombo("", 89, 40, 41, 25)
    GUICtrlSetData($alarmHour, "1|2|3|4|5|6|7|8|9|1|11|12")
    $alarmMinute = GUICtrlCreateCombo("", 147, 40, 43, 25)
    GUICtrlSetData($alarmMinute, "00|01|02|03|04|05|06|07|08|09|10|11|12|13|14|15|16|17|18|19|20|21|22|23|24|25|26|27|28|29|30|31|32|33|34|35|36|37|38|39|40|41|42|43|44|45|46|47|48|49|50|51|52|53|54|55|56|57|58|59")
    $colon = GUICtrlCreateLabel(":", 135, 34, 9, 28)
    GUICtrlSetFont($colon, 14, 400, 0, "MS Sans Serif")
    $target = GUICtrlCreateInput("Pandora,com", 12, 155, 513, 21)
    $targetName = GUICtrlCreateInput("Pandora Radio", 12, 212, 512, 21)
    $browsweHomeTitle = GUICtrlCreateInput("New Tab", 11, 99, 514, 21)
    $Browser = GUICtrlCreateLabel("Your Browser Homepage Title", 13, 65, 258, 28)
    GUICtrlSetFont($Browser, 16, 400, 0, "MS Sans Serif")
    $TargetUR = GUICtrlCreateLabel("Desired Target URL", 10, 125, 169, 28)
    GUICtrlSetFont($TargetUR, 16, 400, 0, "MS Sans Serif")
    $TargetNameInpu = GUICtrlCreateLabel("Desired Target Name", 13, 183, 184, 28)
    GUICtrlSetFont($TargetNameInpu, 16, 400, 0, "MS Sans Serif")
    $timeLabel = GUICtrlCreateLabel("Hour : Minute AM/PM", 88, 11, 185, 28)
    GUICtrlSetFont($timeLabel, 16, 400, 0, "MS Sans Serif")
    $AM_PM = GUICtrlCreateCombo("", 202, 40, 55, 25)
    GUICtrlSetData($AM_PM, "AM|PM")
    GUICtrlCreateGroup("", -99, -99, 1, 1)
    $Okay = GUICtrlCreateButton("&OK", 355, 321, 75, 25, $WS_GROUP)
    GUICtrlSetOnEvent($Okay, "OkayClick")
    $Exit = GUICtrlCreateButton("&Exit the Alarm", 452, 321, 75, 25, $WS_GROUP)
    GUICtrlSetOnEvent($Exit, "CancelClick")
    GUISetState(@SW_SHOW)
    #EndRegion ### END Koda GUI section ###

    While 1
        Sleep(100)
    WEnd

    Func CancelClick()
        Exit
    EndFunc
    Func OkayClick()
        GUISetState(@SW_HIDE)
        GUICtrlRead($alarmHour)
        GUICtrlRead($alarmMinute)
        GUICtrlRead($AM_PM)
        GUICtrlRead($desiredVolume)
        GetAlarmSettings()
        EcecuteAlarm()
        GUISetState(@SW_SHOW)
    EndFunc
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...