Valhalla Legends Forums Archive | General Discussion | Doing the same thing every day.

AuthorMessageTime
iago
I'm not terribly sure how to do this, but I Suspect it could involve Scheculed Tasks :)

Anyway, my mom does crosswords every day, and I need to print them off. So far, I'm doing it manually.

It would be nice to have this automated. The URL each day is slightly different, but I can easily write a C program to calculate this url. So I'm faced with 2 problems:

a) How do I write a C or C++ program to print a website? I'm sure there's a switch on iexplore to do it, which I could run from a program.

b) How do I make sur ethis program runs exactly once a day?
November 6, 2003, 12:17 AM
Skywing
Perhaps the MFC web browser components, WinInet, or wget could be used to fetch the page.

As for only running once per day, you could store the last start date in the registry and check that on startup.
November 6, 2003, 12:19 AM
Spht
What's the URL for the crossword page?
November 6, 2003, 12:22 AM
Thing
cron
November 6, 2003, 12:43 AM
iago
[quote author=Spht link=board=2;threadid=3441;start=0#msg27614 date=1068078172]
What's the URL for the crossword page?
[/quote]

http://www.uclick.com/puzzles/cx/03/11/05/Puzpic.gif


And Skywing - I really didn't want to do it that way, mainly because I don't use that computer every day; in fact, it gets used maybe twice a week. But it's on all the time, as a server type dealy.

I was hoping for an easier way to download the page; in fact, it's a .gif, so is that even possible with your method?

Unless I get some other way of doing it, though, I'll look into those controls; thanks! :)
November 6, 2003, 12:47 AM
Spht
The fastest solution to download the image ("http://www.uclick.com/puzzles/cx/" & Format(Date, "yy/mm/dd") & "/Puzpic.gif") would probably be to use WinInet. In Visual Basic, I'd probably display the image on a picture box (or form) then use the Printer object to paint the image, and then print it. You can store last date in registry as Skywing suggested and have your program automatically ran daily.
November 6, 2003, 1:02 AM
Myndfyr
Hrm, I've been looking into getting into printing with .NET, want me to write you a quick program? It'll run in the tray and print off once a day. Lemme know =)
November 6, 2003, 1:53 AM
Thing
[code]#!/bin/bash

URL=http://www.uclick.com/puzzles/cx/$(date +%y)/$(date +%m)/$(date +%d)/Puzpic.gif
wget $URL
lp Puzpic.gif[/code]

./edit I forgot to add the printing part.
You windows guys always make things difficult. :P
November 6, 2003, 2:22 AM
iago
[quote author=Thing link=board=2;threadid=3441;start=0#msg27641 date=1068085374]
[code]#!/bin/bash

URL=http://www.uclick.com/puzzles/cx/$(date +%y)/$(date +%m)/$(date +%d)/Puzpic.gif
wget $URL
lp Puzpic.gif[/code]

./edit I forgot to add the printing part.
You windows guys always make things difficult. :P
[/quote]

That WOULD be nice, but .. well, you know exactly why it's not! :P

Actually, I'm planning on installing linux sometime soon, but some body needs to convince me. I'm going to post antoher thread on it in the next week or so :)
November 6, 2003, 3:10 AM
Adron
You could just spawn a copy of wget with the right arguments. Or if the page is linked to from some constant url, spawn "wget -r -l 1 <url to page that links to the gif>".
November 7, 2003, 4:25 PM
Spht
http://www.valhallalegends.com/spht/files/cwd.zip

Let me know if it works. I made it faily quickly and never gave it much testing. On run, connects to server to download image file (based on current date), then stores last date in registry, prints off the image, then exits. Storing last date in registry is simply for determining if it already has the image for the current date (incase you happen to run the program twice on the same day). If last date < current date, it'll close.
November 7, 2003, 4:35 PM
Thing
[code]wget http://www.uclick.com/puzzles/cx/$(date +%y)/$(date +%m)/$(date +%d)/Puzpic.gif[/code]
Somanabench, I should have tried that first! For some weird reason I thought that wget would not execute the command in the parenthesis.
November 7, 2003, 4:54 PM
iago
[quote author=Spht link=board=2;threadid=3441;start=0#msg27941 date=1068222905]
http://www.valhallalegends.com/spht/files/cwd.zip

Let me know if it works. I made it faily quickly and never gave it much testing. On run, connects to server to download image file (based on current date), then stores last date in registry, prints off the image, then exits. Storing last date in registry is simply for determining if it already has the image for the current date (incase you happen to run the program twice on the same day). If last date < current date, it'll close.
[/quote]

wow, thanks, Spht! When I get home I'll give it a try!
November 7, 2003, 6:36 PM

Search