• Welcome to Valhalla Legends Archive.
 

Doing the same thing every day.

Started by iago, November 05, 2003, 06:17 PM

Previous topic - Next topic

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?
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


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.

Spht

What's the URL for the crossword page?

Thing

That sucking sound you hear is my bandwidth.

iago

Quote from: Spht on November 05, 2003, 06:22 PM
What's the URL for the crossword page?

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! :)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


Spht

#5
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.

MyndFyre

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  =)
QuoteEvery generation of humans believed it had all the answers it needed, except for a few mysteries they assumed would be solved at any moment. And they all believed their ancestors were simplistic and deluded. What are the odds that you are the first generation of humans who will understand reality?

After 3 years, it's on the horizon.  The new JinxBot, and BN#, the managed Battle.net Client library.

Quote from: chyea on January 16, 2009, 05:05 PM
You've just located global warming.

Thing

#7
#!/bin/bash

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


./edit I forgot to add the printing part.
You windows guys always make things difficult. :P
That sucking sound you hear is my bandwidth.

iago

Quote from: Thing on November 05, 2003, 08:22 PM
#!/bin/bash

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


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

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 :)
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*


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>".

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.

Thing

wget http://www.uclick.com/puzzles/cx/$(date +%y)/$(date +%m)/$(date +%d)/Puzpic.gif
Somanabench, I should have tried that first!  For some weird reason I thought that wget would not execute the command in the parenthesis.
That sucking sound you hear is my bandwidth.

iago

Quote from: Spht on November 07, 2003, 10:35 AM
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.

wow, thanks, Spht!  When I get home I'll give it a try!
This'll make an interesting test for broken AV:
QuoteX5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*