Jump to content

My first GUI! <vbg> Small fix?


Recommended Posts

Well, wow-ee. All this time since I joined the forum and I only just found references to Koda and GuiBuilder this afternoon! D'uh. I found Koda easier to use, but that's me -- the dodo script person, here <g>.

I built the gui below thanks to Koda, but know that I'm missing a couple of things <sigh>. In particular, I'm concerned with the GUISetState(@SW_HIDE) in the Func Click_Snooze() section. I guessed on that one to make the box disappear while it snoozes. Sure, it disappears, but when the snooze time is up, the box doesn't come back up again! Music comes up fine, but not box! (I know, I know, n00b ... ;))

#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
;-----------------------------------------------------------------------------------------
; CHANGE THE FIRST # FOR EACH REMINDER -- in the "LEFT" option in GUICreate just below ...
; START OFF WITH 200, 100 but increment, as needed, when they overlap ...
$Form1 = GUICreate("Message Reminder ...", 350, 150, 200, 100); Width, Height, Left, Top.
;-----------------------------------------------------------------------------------------

$Label2 = GUICtrlCreateLabel("TIME SHEET, enter time into it" & @CR & "if you're on an agency contract.", 22, 16, 625, 50);  Left, Right, Width, Height of inside text box.
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
$Snooze = GUICtrlCreateButton("Snooze", 80, 112, 75, 25, 0)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetOnEvent(-1, "Click_Snooze")
$Cancel = GUICtrlCreateButton("Cancel", 176, 112, 75, 25, 0)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetOnEvent(-1, "Click_Cancel")
GUISetState(@SW_SHOW)



While 1
    Sleep(100)
WEnd

Func Click_Cancel()
     Exit
 EndFunc     ;  End "Click_Cancel".


Func Click_Snooze()
         GUISetState(@SW_HIDE)
         $input = InputBox("''TIME SHEET Reminder'' ... ", "Snooze for how many minutes?", 15)
         $time = $input*1000*60
         Sleep($time)
         
         #NoTrayIcon     ; AutoIt's icon doesn't show in systray
         SoundPlay(@ScriptDir & "\..\WAVs\WAVppro- Birthday- music box.wav")
EndFunc     ;  End "Click_Snooze".

Lastly, the upper right-hand, red X button doesn't work in the GUI. 'course, in Koda, the minute I touch that red button, things close down so couldn't add an event to that button. Built-in, I guess. This would be fine if it followed standard Windows behaviour and closed the box in the resulting script, but it doesn't.

Is there any way to fix both these things?

Thanks!!! :P

Link to comment
Share on other sites

This has nothing with Koda.

Koda makes GUI for you but you must write script logic yourself.

Here it is:

#NoTrayIcon     ; AutoIt's icon doesn't show in systray
         #include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)
;-----------------------------------------------------------------------------------------
; CHANGE THE FIRST # FOR EACH REMINDER -- in the "LEFT" option in GUICreate just below ...
; START OFF WITH 200, 100 but increment, as needed, when they overlap ...
$Form1 = GUICreate("Message Reminder ...", 350, 150, 200, 100); Width, Height, Left, Top.
GUISetOnEvent($GUI_EVENT_CLOSE, "Click_Cancel")
;-----------------------------------------------------------------------------------------

$Label2 = GUICtrlCreateLabel("TIME SHEET, enter time into it" & @CR & "if you're on an agency contract.", 22, 16, 625, 50);  Left, Right, Width, Height of inside text box.
GUICtrlSetFont(-1, 16, 400, 0, "MS Sans Serif")
$Snooze = GUICtrlCreateButton("Snooze", 80, 112, 75, 25, 0)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetOnEvent(-1, "Click_Snooze")
$Cancel = GUICtrlCreateButton("Cancel", 176, 112, 75, 25, 0)
GUICtrlSetFont(-1, 12, 400, 0, "MS Sans Serif")
GUICtrlSetOnEvent(-1, "Click_Cancel")
GUISetState(@SW_SHOW)


While 1
    Sleep(100)
WEnd

Func Click_Cancel()
     Exit
 EndFunc     ;  End "Click_Cancel".


Func Click_Snooze()
         GUISetState(@SW_HIDE)
         $input = InputBox("''TIME SHEET Reminder'' ... ", "Snooze for how many minutes?", 15)
         $time = $input*1000*60
         Sleep($time)
                  GUISetState(@SW_SHOW)
SoundPlay(@ScriptDir & "\..\WAVs\WAVppro- Birthday- music box.wav")
EndFunc     ;  End "Click_Snooze

EDIT: Read AutoIt helpfile there are nice sections about GUI OnEvent mode

Edited by Zedna
Link to comment
Share on other sites

This has nothing with Koda.

Koda makes GUI for you but you must write script logic yourself.

;) Oh well, phooey, Party Pooper!!! <lol> And I was like a little kid, so happy I'd found a way to do some custom work. My stuff is so rudimentary half the time to begin with, I just have trouble with that so-called logic. I'm quite logical, just can't seem to wrap my brains around scripts <g>.

Thanks for the completed GUI. I've made about 25 "reminders" now based on your version. Thanks. Things working awesome now. :P

Link to comment
Share on other sites

  • 2 weeks later...

Just wanted to come back with a quick update, this system is working very well. Yes, it's cumbersome, but I haven't found a good reminder program that will work decently off the thumb drive (i.e., a truly portable one). Everything in Windows is so drive-letter driven with absolute paths it's a pain. But this one reminder/launcher/scheduler freeware I use can be made to work as a portable and it launches the AI scripts very well with completely relative paths. So I now have easy to use reminders that I can now snooze! <g> Just makes me that much more efficient and quicker at work! Started another contract this past Friday and no fiddling. I was up and running immediately for once just by plugging in my 4-gig Memorex! Thanks again. :)

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...