Page 1 of 1
Help on a "remind" program
Posted: Tue Mar 02, 2010 10:11 pm
by urbaud
I want to write a small standalone program, in Rev, that would automatically place a dialog box on the desktop at the start up of the computer. I’ve done some programming, as a hobby, in Rev, but none what would involve getting a program to work at start up. It would display birthdays, events of the day, etc.--essentially a reminder program. My problem is I don’t know where to look to see examples of code that does this kind of thing and I don’t know what keywords to lookup in the dictionary to help me get started. The basic design would be a dialog box with a field(s) that would display an event on a given day using the system clock. It would also have a way for me to input a date and event. If someone could give me some links or other suggestions to help me get going on this project, I’d really appreciate your help.
Re: Help on a "remind" program
Posted: Wed Mar 03, 2010 4:25 pm
by bn
Dan,
this sounds like a pretty ambitious project. What are you interested in? The startup process? On a Mac you can use the control panel-> user -> startup up apps to add an app to be started at the system start.
Your app would have to monitor the time regularily. Send a message to me in xxx seconds would be a means to keep track of this. This thread discusses some of the aspects of this
http://forums.runrev.com/phpBB2/viewtop ... eze#p19715
You would also like to look up how Rev handles time and date. The dateitems are useful to convert / add / subtract from any given time/date.
Sarah Reichelt has a stack/library to handle all sorts of time / date problems
http://www.troz.net/rev/index.irev?cate ... ary#stacks
look for dateTime
How do you want to do your interface? you would have to save a date/time in a format that is easy to work with, the seconds seem to do fit that.
I call your project ambitious because of all the small problems that will arise while developing this. Maybe you start with a simple stack that you put a time/date into and let the stack monitor this.
regards
regards
Bernd
Re: Help on a "remind" program
Posted: Wed Mar 03, 2010 5:41 pm
by FourthWorld
You can do this entirely in Rev if you're okay with having your app always running. But OSes have supported this in a more lightweight fashion with a variety of notification mechanisms, so your app can run only when it needs to.
On Windows see the Program Scheduler, and on OS X and Linux man cron. There are probably ways you can automate setting this up for all three platforms, but alas I have no code examples handy for that. Maybe someone else here does.
Re: Help on a "remind" program
Posted: Thu Mar 04, 2010 1:17 am
by urbaud
Hi Bernd & Richard,
I must thank you both for responding, because when I was drafting the original draft of my post I had included a short paragraph asking that someone consider “taking me under their wing” to help guide me through this project. I don’t expect either of you to do that ‘cause you’re both working I assume and it’s not fair for me to ask anyone to do this so that’s the reason it’s not in this post. I just want to learn how I would create a program that would automatically install its self into memory, check the date and if there was some event connected to that date, then to display it. I don’t know if you know about TSR’s (Terminate and Stay Resident, I believe) in the windows world, I don’t either, but I’ve always wanted to learn how to make a program do that and I have been looking and looking for a remind program like the one I used at work every day, but in the Mac environment-haven't found one yet. It was a small remind program, running under windows, and each time I would boot up, a dialog would appear in the middle of the screen telling me that I needed to act on something if there was a date attached to it. I relied on it a lot. Some people call it a diary system, where I worked it was called a “Bring forward” program. I think that those TSR programs ran all the time as Richard has suggested.
I really have no idea as to what the complexity of a project like is because I’m just an old retired guy having fun learning to program in Rev. I did some basic programming for work when I was working, but that was some time ago.
Bernd, I guess I will take your advise and “start with a simple stack that you put a time/date into and let the stack monitor this.” Of course I don’t know how to do this. I also asked Devin Asay about whether I could audit some of the Rev courses he teaches at BYU. At the time there wasn’t the ability to do that but if I remember correctly he was just beginning a planning process to see if BYU could do it. If it was a yes then he was going to advertise it on this forum some place.
Bernd, can you give me some starter suggestions and Richard what would I do to use the more “lightweight...variety of notification mechanisms”? Please let me know if you can give suggestions, if not, I understand and won’t be offended.
Thanks for reading this.
Dan
Re: Help on a "remind" program
Posted: Thu Mar 04, 2010 1:55 am
by FourthWorld
urbaud wrote:Hi Bernd & Richard,
I must thank you both for responding, because when I was drafting the original draft of my post I had included a short paragraph asking that someone consider “taking me under their wing” to help guide me through this project.
It's even better than that: here in these forums you get Klaus, Mark, Bjornke, Malte, Trevor, and many others too, all for the low price of just asking.
This page may help you get started with cron:
http://www.macosxhints.com/article.php? ... 0700163714
To call cron from Rev you'd use the shell function.
Re: Help on a "remind" program
Posted: Thu Mar 04, 2010 2:11 am
by FourthWorld
Alternatively, if you don't mind having your app running all the time you can use "send in <time>" to send notification - here's a quickie example that lets you send any message to any object at any specific date and time:
Code: Select all
on mouseUp
Notify "3/3/10 5:10 pm", "SomeMessage", the long id of me
end mouseUp
on Notify pDateTime, pMessage, pObj
convert pDateTime to secs
if the result is not empty then put the result
put ((pDateTime)- the secs ) into tDelay
send pMessage to pObj in tDelay seconds
end Notify
on SomeMessage
answer "Here's your notification!"
end SomeMessage
Re: Help on a "remind" program
Posted: Sat Mar 06, 2010 5:13 pm
by bn
Dan,
urbaud wrote:I have been looking and looking for a remind program like the one I used at work every day, but in the Mac environment-haven't found one yet. It was a small remind program, running under windows, and each time I would boot up, a dialog would appear in the middle of the screen telling me that I needed to act on something if there was a date attached to it. I relied on it a lot
on the Mac there is iCal that does exactly what you want. It is preinstalled. (if I understand you correctly)
If you want to try to do your own I will gladly try to help you. But you would have to outline what exactly it is that you want. Could you describe in little more detail what you would like to implement in such an application.
urbaud wrote:I had included a short paragraph asking that someone consider “taking me under their wing”
Unfortunately I don't have wings since I am a poor earth-bound pedestrian. And I wouldn't like to take you under my feet, makes walking difficult...
But some of the people Richard mentioned here on the forum seem to fly...
regards
Bernd
Re: Help on a "remind" program
Posted: Mon Mar 08, 2010 8:02 pm
by urbaud
Hi Bernd and Richard,
Bernd, I didn’t know that iCal has the remind function. I haven’t used iCal in the past, but when you mentioned it I tried it. Low and behold, it does what I want. So, with that in mind, I don’t think I will proceed with my “remind program” project. I realized, after both of your responses, that I was getting in “way over my head.” It reminded me how little I know about Rev and what a true beginner Rev programmer I am. How long has it taken you guys to get so proficient in Rev, and Bernd do you make your living using it? Richard, you obviously make your living at it. Richard, how would I use the shell command to call cron (whatever it is)? I’m curious about this stuff, so if your so inclined and have an easy way of showing me, I’d appreciate seeing what it does.
Richard, I am trying to understand how your “send in <time>” notifier works. I don’t know what it’s suppose to do and I don’t really know how to implement it to see what it does. I put it in a stack and on the mouseUp handler it showed a dialog, “Here’s your notification.” Am I suppose to be able to change this date: Notify "3/3/10 5:10 pm", "SomeMessage", the long id of me? I want to learn what this notifier does, so if there is a simple way to show me I’d appreciate it.
Dan
Re: Help on a "remind" program
Posted: Tue Mar 09, 2010 1:16 am
by bn
Dan,
I dont make a living using Rev. Although I use it at work extensively. Nor am I as experienced as Richard and a lot of people here on the forum.
I attach a very simple stack which shows the send command. The button sends a message to itself once. 10 seconds later the message arrive at the button and triggers a handler that displays the time you pushed the button and the current time. Have a look at the button script. The nice thing about the send command is that you can send it repeatedly. It then checks a condition and acts upon it, like displaying a scheduled event. It then would go on to check regularily. Basically your reminder. That is what Richard posted.
Look at the attached stack and try to understand what is going on. Than Richards example will be clearer.
Under the Help Menu in the Resource Center -> Tutorials ->Applications -> displaying a count down (non-blocking) explains send in time well.
regards
Bernd