none
small basic reminder.

    Question

  • I want to make a small reminder program in small basic. Basically i want it so that you are prompted for what time you want to be reminded at, after this has been recognised i want it so you put in a message to be reminded of and then at the time of the reminder it opens a window saying this message. however i am new to programming so need a bit of help. i can't think of a way for the program to recognise what time the user has entered without making an if statement for every minute up to 60.

    any ideas? also if you can see any other problems i may encounter could you tell me. thanks!

    Sunday, July 07, 2013 9:25 AM

Answers

  • Hi Torak,

    Some months ago I published a countdown alarm timer (see RCL646)

    It can countdown from a given startvalue (hour,minute,second) and give an alarm at zero.

    You can also give a clocktime, the program calculates the remaining time and countdown from there.

    A third possibility is to use it as a timer (without alarm)

    You can see in that program some ways to do time calculations.


    Jan [ WhTurner ] The Netherlands

    Sunday, July 07, 2013 2:15 PM
  • How about this?

    ' every minute up to 60 ?
    GraphicsWindow.BrushColor = "Black"
    GraphicsWindow.FontSize = 30
    start = Clock.ElapsedMilliseconds
    Timer.Interval = 1000
    Timer.Tick = OnTick
    times = 1
    While times <= 60
      Sound.PlayChime()
      obj = Shapes.AddText("message " + times)
      Shapes.Move(obj, 100, 100)
      For opacity = 100 To 0 Step -10
        Shapes.SetOpacity(obj, opacity)
        Program.Delay(1000)
      EndFor
      Shapes.Remove(obj)
      Program.Delay(50000)
      times = times + 1
    EndWhile
    Sub OnTick
      now = Clock.ElapsedMilliseconds
      GraphicsWindow.Title = Math.Floor((now - start) / 1000)
    EndSub


    Nonki Takahashi


    Thursday, July 11, 2013 10:46 AM

All replies

  • Without using an extension you pretty much have to keep checking the time using the Clock methods.

    You could only check every minute using the Timer.

    Also consider looking at the Clock.EllapsedMilliseconds which is the current absolute time and is the best way to deal with elapsed time.  Using this you could just check if the current EllapsedMilliseconds > start+interval, if you can calculate the interval from the user input time.

    It all depends to some extent exactly how the user enters when the alarm should go off.

    Sunday, July 07, 2013 11:19 AM
  • ok thankyou, very helpful ^^
    Sunday, July 07, 2013 11:42 AM
  • Hi Torak,

    Some months ago I published a countdown alarm timer (see RCL646)

    It can countdown from a given startvalue (hour,minute,second) and give an alarm at zero.

    You can also give a clocktime, the program calculates the remaining time and countdown from there.

    A third possibility is to use it as a timer (without alarm)

    You can see in that program some ways to do time calculations.


    Jan [ WhTurner ] The Netherlands

    Sunday, July 07, 2013 2:15 PM
  • How about this?

    ' every minute up to 60 ?
    GraphicsWindow.BrushColor = "Black"
    GraphicsWindow.FontSize = 30
    start = Clock.ElapsedMilliseconds
    Timer.Interval = 1000
    Timer.Tick = OnTick
    times = 1
    While times <= 60
      Sound.PlayChime()
      obj = Shapes.AddText("message " + times)
      Shapes.Move(obj, 100, 100)
      For opacity = 100 To 0 Step -10
        Shapes.SetOpacity(obj, opacity)
        Program.Delay(1000)
      EndFor
      Shapes.Remove(obj)
      Program.Delay(50000)
      times = times + 1
    EndWhile
    Sub OnTick
      now = Clock.ElapsedMilliseconds
      GraphicsWindow.Title = Math.Floor((now - start) / 1000)
    EndSub


    Nonki Takahashi


    Thursday, July 11, 2013 10:46 AM
  • How about this?

    ' every minute up to 60 ?
    GraphicsWindow.BrushColor = "Black"
    GraphicsWindow.FontSize = 30
    start = Clock.ElapsedMilliseconds
    Timer.Interval = 1000
    Timer.Tick = OnTick
    times = 1
    While times <= 60
      Sound.PlayChime()
      obj = Shapes.AddText("message " + times)
      Shapes.Move(obj, 100, 100)
      For opacity = 100 To 0 Step -10
        Shapes.SetOpacity(obj, opacity)
        Program.Delay(1000)
      EndFor
      Shapes.Remove(obj)
      Program.Delay(50000)
      times = times + 1
    EndWhile
    Sub OnTick
      now = Clock.ElapsedMilliseconds
      GraphicsWindow.Title = Math.Floor((now - start) / 1000)
    EndSub


    Nonki Takahashi



    This solution could become a TechNet Wiki article and enter the July Small Basic Guru contest: http://social.technet.microsoft.com/wiki/contents/articles/18211.technet-guru-contributions-july-2013.aspx

     

    Great job!


    Ed Price (a.k.a User Ed), SQL Server Customer Program Manager (Blog, Small Basic, Wiki Ninjas, Wiki)

    Answer an interesting question? Create a wiki article about it!

    Tuesday, July 23, 2013 6:48 AM
  • all really helpful answers guys! thanks!
    Sunday, July 28, 2013 9:44 AM