Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27017

VS 2010 HowTo: Running a vb project on a timed 'schedule'

$
0
0
Ok so my current VB project has been complete for some time now. When I start it up, it performs its desired functions over the course of between a 12 & 24 hour period. When It's finished I have to go back, start it back up & change the variables. Now on an ordinary day that presents no issue, but as I get busier with college/work/programming I find myself having less time to go & re-start all the instances of my application.
The variables i need to change are just integers inside of Textbox1.text (90) & Textbox2.text (120), which need to be ticked up to textbox1 = (121) .. textbox2 = (151) & then there is button1 which is "Start" which simply needs to be re-engaged at 'scheduled times'.

So would it be possible to create a helper application to do this? I.E. a small app i can keep in the taskbar 24-7, which holds the 'scheduling' info & integer values. Let's call it AppScheduler.exe. And lets call my main program regular old Program1.exe.

Program1.exe's main "sequence" typically runs for 12-24hrs is based on a simple Case Select/Loop inside a timer & when its finished performing its tasks it closes itself *me.close()* via the 'Else' in the timer.

So I want to build AppScheduler.exe with a calendar/clock type object on the form. It needs to know when Program1.exe is finished, which i think I can figure out how to do that, perhaps using API seeing if a windows present, or even a php variable on a webpage. I would also say perhaps sending a message to the programs window but I do not know how to do that. I don't really want to use/rely on a Mysql database for this. (I'm open to suggestions!)

Now then there is a "set amount" of time I want AppScheduler.exe to wait before it ticks up the variables & sets them on Program1.exe's textbox's..and then re-starts it. Let's call it 2 hours. Now that would be simple to accomplish using a Timer set to 3,600,000, however I have variables for the time of day when I don't want it re-started. So typically if its been 2 hours...it should re-start Program1.exe..but if the current time is between: (weekdays) 3:30AM-->8:30AM MONDAY-THURSDAY. Then I it should not re-start Program1.exe again until it is at least 8:31AM. Then also...If it's waited 2 hours and its a (weekend) 5:30AM-9:30AM FRI-SUNDAY then it shouldn't be allowed to re-start until 9:31AM

So to summarize...AppScheduler.exe will be a small task-bar program, capable of detecting when/if Program1.exe has been closed, at which point AppScheduler.exe will start a 2-HOUR "wait before re-load" period based on a internal clock/calender...at which point it will load Program1.exe, ticking up integers (based on the integers currently present on Program1.exe textbox1.text & textbox2.text) & then clicking Button1 (START). Unless the time is (weekday) 3:30AM - 8:30AM or (weekends) 5:30AM-9:30AM, in which case it will wait until either 8:31AM or 9:31AM depending on the day of the week..before clicking button1_click aka (start) on Program1.exe.

I realize I could simply incorporate this scheduling into Program1.exe itself but I really need to keep this as an independent application incase my Program1.exe errors (I'm still a newb so it does happen!)

I've probably just made something incredibly simple look incredibly complicated since it took me 3 paragraphs & almost 2 hours to try to explain what I'm trying to do! :wave::ehh::p

Viewing all articles
Browse latest Browse all 27017

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>