Jump to content

MsgBox | if | gui | beta problem


TMXOD
 Share

Recommended Posts

The attached file is a script I am working on. When finished, it will be a fully functional alarm clock. From what I have right now, I only have a single problem. A MsgBox should come up and explain to the user that the time they inputted has already passed today and that the alarm will be set for the following day. (ALARMCLOCK.AU3, lines 126 to 129)

;...
Global $warned= IniRead(@ScriptDir & "\alarm.ini", "Misc", "WarnedAboutTomorrow", False)
;...
If $warned = False Then
  MsgBox(64 + 262144, "Alarm Error", "The time currently selected has already passed today." & @CRLF & "If the alarm is activated with the current settings," & @CRLF & "it will go off tomorrow at that time.")
  $warned = True
EndIf

The problem is that the msgbox never shows up.

Try it out for yourself.

Make sure you use latest AutoIt3 beta.

Debugging information will be printed to StdOut...

Unless I have overlooked something somewhere else in the code, that should work.

Weird, huh?

Edited by DaProber
Link to comment
Share on other sites

I think that this is probably a limitation of Windows' own INI manipulation functions. What's happening is that $Warned is being set to the string value 'False', which is not equivalent to the Boolean False.

Local $Var = INIRead('NonExistentINI', 'Section', 'Key', False)
MsgBox(0x40, '$Var', $Var)
MsgBox(0x40, '$Var is Boolean?', IsBool($Var) And True)
MsgBox(0x40, '$Var is a string?', IsString($Var) And True)

The only way that this can be solved is if AutoIt can internally determine whether the specified key exists and then override Windows' behaviour in such a case. You could do this though:

If $Warned = 'False' Then
Link to comment
Share on other sites

That would do it...

Thanks for pointing out that about how AutoIt works...

EDIT: I worked around it by writing an all-purpose Boolify function, where you pass a var and returns either true or false. That problem is now solved...

Off to finish my alarm clock...

EDIT: now I'll write something to make the sound file play but make the cancel/snooze work immediately, not having to wait until the file finishes playing. I'm thinking a separate script that loops and have the master script kill it when cancelling/snoozing...

ANOTHER EDIT: It is done... everything works, and I see no problems other than the obvious one when attempting to compile (@autoitexe will be the compiled script and the slave script will not work...). If any admin/mod sees this, feel free to move this topic/thread/whatever this is called into the scripts/scraps subforum. Thanks...

BTW: latest working version of the script is this one --->

Edited by DaProber
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...