Loading ...
Sorry, an error occurred while loading the content.

timer and closing apps

Expand Messages
  • dean martineau
    I have a couple questions: 1. Is there a way for the timer to perform an action every five minutes? I can t figure out syntax to have it activate whenever
    Message 1 of 8 , Dec 14, 2002
    • 0 Attachment
      I have a couple questions:

      1. Is there a way for the timer to perform an action every five
      minutes? I can't figure out syntax to have it activate whenever the minute
      ends in either 5 or 0.

      2. What is the best way, or what are possible ways, to have a clip close
      an external program. So far, ^!playback alt+f4 hasn't worked.

      Thanks.

      Dean
    • Alan C.
      Hi Dean, ... The next (entire set of clips) is a basic that does so. More bells and whistles could be added. As it currently is, once started, it doesn t
      Message 2 of 8 , Dec 14, 2002
      • 0 Attachment
        Hi Dean,

        >1. Is there a way for the timer to perform an action every
        >five minutes?

        The next (entire set of clips) is a basic that does so. More bells and whistles could be added. As it currently is, once started, it doesn't stop until you launch the Stop reminding clip (or close--doesn't mean hide--the clipbook combo window OR shutdown/close NoteTab).

        H="StartTimer"
        ; Timer event will be triggered every 30 seconds
        ^!TimerStart 30000
        ; The timer will activate the Clip "my_reminder" at every 30 seconds interval
        ; but the my_reminder clip checks--minute on either 0 or 5 allows action
        ^!TimerPlay my_reminder
        ; Display confirmation message
        ^!Prompt The "my_reminder" 5 minute event is now active

        H="_my_reminder"
        ; 1 of 2 digits stripped, leaves the RH digit
        ^!Set %time%=^$StrCopyRight("^$GetDate(nn)$";1)$
        ^!IfSame "5" "^%time%" myreminder1
        ^!IfSame "0" "^%time%" myreminder1
        ^!GoTo End

        :myreminder1
        ; ^!IfTrue ^%p_myreminder1% End

        ; here is the every 5 minute activation interval
        ^!Prompt Important! The minute is on ^%time%
        ; ^!Set %p_myreminder1%=True

        ; a 1 minute and 9 second delay (so that it doesn't get
        ; back out of here to check again within 30 seconds)
        ^!Delay 690
        ^!GoTo End

        H="Stop reminding"
        ;Stop the Clip timer and display confirmation message
        ^!TimerStop
        ^!Prompt The timer has now been disabled. Double-click on the "StartTimer" Clip to resume.
        ; ---<end of 5 minute interval timer clips<<


        Since the timer is set to check every 30 seconds, I included the line
        ^!Delay 690
        which (for a minute and 9 seconds) keeps the gate closed so to speak then after that minute and 9 seconds it reverts to the every 30 second checking once again. (without that line, instead of once, it can prompt twice whenever the minute is on either 0 or 5)

        (the only thing I'm not certain of: regards whether or not it's good practice to use the ^!Delay command) (the clips potentially could be structured differently so that the ^!Delay is not needed) But it works as it is; I was only thinking of how it might affect if you also want to run other clips while this timer thing is active/running.

        >2. What is the best way, or what are possible ways, to have a
        >clip close an external program.

        Use NTB to get the app focused. Then hopefully it is an app that can be closed using the keyboard and the app's menu. (use NTB to send it the appropriate keystrokes from the keyboard)

        help > help on clip programming > index tab > ^!FocusApp

        and

        help > help on clip programming > index tab > ^!Keyboard

        and

        SampleCode clip library its keyboard examples.

        --
        Alan.
      • Alan C.
        I got rid of the ^!Delay command. Works even better. Notice in the updated further below, a new ^!IfSame line followed by a new ^!Set line then the same 5
        Message 3 of 8 , Dec 15, 2002
        • 0 Attachment
          I got rid of the ^!Delay command. Works even better. Notice in the updated further below, a new ^!IfSame line followed by a new ^!Set line then the same 5 minute interval. Notice a new :bypass (a label) after the 5 minute interval. And notice that I removed the ^!Delay 690

          >:myreminder1
          >; ^!IfTrue ^%p_myreminder1% End
          >
          >; here is the every 5 minute activation interval
          >^!Prompt Important! The minute is on ^%time%
          >; ^!Set %p_myreminder1%=True
          >
          >; a 1 minute and 9 second delay (so that it doesn't get
          >; back out of here to check again within 30 seconds)
          >^!Delay 690
          >^!GoTo End

          :myreminder1
          ; ^!IfTrue ^%p_myreminder1% End
          ^!IfSame "^%verify%" "^%time%" bypass
          ^!Set %verify%=^%time%
          ; here is the every 5 minute activation interval
          ^!Prompt Important! The minute is on ^%time%
          :bypass
          ; ^!Set %p_myreminder1%=True
          ^!GoTo End
          ; ---end of clip stuff---

          --
          Alan.
        • Sheri <silvermoonwoman@comcast.net>
          Hi Lee, I m glad that worked ok, glad to help. I just noticed that I made an error in the replace clause by leaving a percent off the end of ^%empty%.
          Message 4 of 8 , Dec 15, 2002
          • 0 Attachment
            Hi Lee,

            I'm glad that worked ok, glad to help.

            I just noticed that I made an error in the replace clause by leaving
            a percent off the end of ^%empty%. Although it seems to be working
            without a closing percent this time, it doesn't always work out that
            way. You should fix it in your saved version. Either of the
            following would be fine.

            ^!Replace "\"[^"]+\"\s" >> "^%empty%" RSIA

            or

            ^!Replace "\"[^"]+\"\s" >> "" RSIA

            Regards,
            Sheri
          • Alan C.
            Timer itself now (changed) set at 5 minutes interval. Therefore, no need for checking/testing in the my_reminder clip. So, removed any code for conditional
            Message 5 of 8 , Dec 15, 2002
            • 0 Attachment
              Timer itself now (changed) set at 5 minutes interval. Therefore, no need for checking/testing in the my_reminder clip. So, removed any code for conditional testing from the my_reminder clip. (Easier way) to just have a repeated 5 minute interval action/reminder.

              >H="StartTimer"
              >; Timer event will be triggered every 30 seconds
              >^!TimerStart 30000
              ><snipped but do note the 4 zeros above>
              >H="_my_reminder"
              >; 1 of 2 digits stripped, leaves the RH digit
              >^!Set %time%=^$StrCopyRight("^$GetDate(nn)$";1)$
              >^!IfSame "5" "^%time%" myreminder1
              >^!IfSame "0" "^%time%" myreminder1
              >^!GoTo End
              >
              >:myreminder1
              >; ^!IfTrue ^%p_myreminder1% End
              >
              >; here is the every 5 minute activation interval
              >^!Prompt Important! The minute is on ^%time%
              >; ^!Set %p_myreminder1%=True
              >
              >; a 1 minute and 9 second delay (so that it doesn't get
              >; back out of here to check again within 30 seconds)
              >^!Delay 690
              >^!GoTo End

              H="StartTimer"
              ; Timer event will be triggered every 5 minutes (5, not 4 zeros)
              ^!TimerStart 300000
              ; The timer will activate the Clip "my_reminder" at the defined time interval
              ^!TimerPlay my_reminder
              ; Display confirmation message
              ^!Prompt The "my_reminder" 5 minute interval event is now active

              H="_my_reminder"
              ; ^!IfTrue ^%p_myreminder1% End
              ; here is the every 5 minute activation interval
              ^!Prompt Important! This is a 5 minute reminder!
              ; ^!Set %p_myreminder1%=True
              ^!GoTo End
              ; ---end of clip---

              --
              Alan.
            Your message has been successfully submitted and would be delivered to recipients shortly.