Jump to content

Printing the Daily Crossword

automator

  • Please log in to reply
1 reply to this topic

#1
foolgladly

foolgladly

    InsanelyMac Protégé

  • Members
  • Pip
  • 1 posts

Hello, everyone.  Long time listener, first time caller.

 

Here's what I'm setting out to do:  because I can no longer reliably receive a delivery of the New York Times for my daily crossword obsession, I'm now a subscriber to their digital crossword.  I still prefer to do the puzzle on paper, and fortunately the NYT offers a scale PDF of the puzzle each day.  I'm hoping to write a script (I'm incredibly new to this) to download the file and print it every day so that I can feel like I live in a future where magic robots deliver my crossword puzzle to my printer each morning.

 

The file naming scheme is simplistic and consistent.  As an example, here's today's PDF location:

 

https://www.nytimes....int/Nov1017.pdf

 

Obviously, the only thing changing here daily is the file name.  I'm hoping I can use today's date to scrape the relevant information and generate the correct filename on a daily basis.

 

From there I assume it should be trivial to download the file to a specific location and automatically send it to the printer.  I've been poking around, and I have some level of confidence that I can pull off the downloading and printing parts.  I don't, however, have any idea how to get started generating the daily file name.

 

Any assistance you can provide would be hugely helpful.  I know the basic answer is "learn to code, it's really helpful."  I'm willing to put some time and effort in here, but I figured this would be a great place to start.

 

Thanks in advance, and happy Veteran's Day!



#2
smolderas

smolderas

    InsanelyMac Sage

  • Members
  • PipPipPipPipPip
  • 362 posts
  • Gender:Male

You could do such basic tasks either programmatically (if you want to learn some programming language) or better script them.

Try to make yourself comfortable with bash and learn to use commands with it.

For example you could use "curl" to transfer data from a server and "date" to read the current date and do some math and string concatenation with "bash" to get the targeted date, if you can't read that information from the file name or from the file directly. It'll be hard to read the date from a PDF file, if it is not compiled with such information.

After you have all that, you could just print that file with "lpr".








0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

© 2017 InsanelyMac  |   News  |   Forum  |   Downloads  |   OSx86 Wiki  |   Designed by Ed Gain  |   Logo by irfan  |   Privacy Policy