My host would not allow me to run cron jobs, so I’ve been looking for a way to keep my post-by-email function running without the need for manual updates. The only way I could think to do this was to find a way to locally automate the running of my wp-mail script. I have found a way to do this using two freeware tools:
1) VisualCron (this is basically a cron application for windows)
2) A quick VB program I wrote myself to load a website
With VisualCron you can set up local applications to run at specific time intervals. The crucial feature is that you are allowed to pass command-line arguments to the applications you are calling. You could use IE with an argument for your post-by-mail script, but the trouble is that you have no way to kill the instance of IE after it has called your script. This would result in an additional running instance for each time your script was run. Plus, the process is not transparent, so if you’re working on your computer at the time the process runs, IE would pop up in your face and you would have to minimize it.
To fix that, I wrote a quick VB app which utilizes a Microsoft dll control which basically is IE as a VB control. What makes this program act different from IE is that I’ve programmed it to accept the argument “killMe” to the program, which 1) Makes the process transparent (it doesn’t interrupt you if you’re working), and 2) kills the app after the script is done loading (thus you will not have hundreds of instances running if you leave your machine alone).
I don’t know what happens when Windows is left alone for a while (you know how it turns the monitor and hard disks off? I don’t know if that might somehow terminate the process…), so stand by while I test it out. I’ll post a follow-up tomorrow.
Oh, and as-of-yet I haven’t written any error-handling for my little app, so use at your own risk. I’ll be uploading it to my website as soon as I post this, but use it at your own risk until I polish it. As it is, here’s instructions on getting it to work:
- Download the programs (I know VisualCron is available from download.com)
- In the same folder you plan on running my app from, create a file called “URLs.txt” containing the URI to your wp-mail script.
- Install VisualCron, and set up the other app to run periodically
- Be sure to pass the argument “killMe” to the app (just type “killMe” in the “arguments” field when you are setting up the job)
- Minimize VisualCron. (it will remain in the system tray, if you actually want to quit VisualCron, you must right-click on it and select “Exit”)
That’s it! At this point your post-by-mail ought to be updating automatically assuming your computer has an active internet connection.
As I said, I’ll be posting my app on my website, and if any real programmers want it (as opposed to me, I’m a just-for-fun VB guy), I’ll be posting the source files as well (they’re from the ancient VB version 5, so don’t laugh at me, please… :0) )
Please post any issues here…
- The topic ‘No cron job necessary (a quick tutorial)’ is closed to new replies.