Sunday, October 6, 2013

Picture of the day - Part 2

Picking up where Part 1 left off, I tried to do a better way to create a picture of the day for Geektool to use.

 As Wikipedia picture of the day was in the standard format

http://en.wikipedia.org/wiki/Template:POTD/yyyy-mm-dd 

I decided to just grab what I needed.
At first I researched using variables in Automator, but it seem to handle appending text,all the forums had people creating Applescripts to build up dynamic text.

So I whipped up the applescript:

 set myURL to "http://en.wikipedia.org/wiki/Template:POTD/"
 
 set myshort to short date string of (current date)
 set myday to items 1 through 2 of myshort
 set mymonth to items 4 through 5 of myshort
 set myyear to items 7 through 10 of myshort
 
 set myURL to myURL & myyear & "-"
 set myURL to myURL & mymonth & "-"
 set myURL to myURL & myday
 
 return myURL

in order to get constancy on the date I had to force the short dat to be 2 digits\2digits\4 digits
You can do this in System Preferences > Language and Text > Formats > Customize
that gave the short date the format 01/01/1970 where I could use the "to items 1 through 2" to pick it apart so I could use it as I wanted.

So I came up with what I hoped was a working workflow:

Except it didn't work.
It dumped the files to folder abc123 okay, again it had the extra images I didn't need as well as the POTD in .jpg format.
Putting in a 'view results' into each step of the workflow, I could see what was going on.
It seems that my 'Filter Finder Items' wasn't working as I expected. It didn't return anything to be renamed, and then moved. Maybe I wasn't using it properly and selecting Desktop > abc123 properly.
Maybe I could work it out, but I still wasn't happy that the Save Images was only getting the thumbnail of the Picture of the Day.

How I solved it in a way I was happy with will be part 3.

No comments:

Post a Comment