Sign in to follow this  
Followers 0
maqleod

Pearls Before Swine Downloader

1 post in this topic

This is a pretty pointless app, but i find it useful because I love this strip (it can be easily modified to accommodate any strip on comics.com) Anyway, as it is now, it downloads the current day's Pearls Before Swine strip to a folder of your choosing, it will remember what you enter for the folder. Sooner or later I'll add an automate function so it will download it automatically for you, but this is all I got so far.

Mostly I wrote it because I'm too lazy to navigate through that site each day to get to the newest one, and I made the app open it for me too so I don't have to navigate to the folder either.

Hope you like it or at least find some part of it useful for something else.

;Pearls Before Swine Downloader
;v.1.0
;written by MaQleod
#include <GUIConstants.au3>
#include <INet.au3>
#NoTrayIcon

$name = "Pearls Before Swine Downloader"
$targetcheck = RegRead("HKEY_CURRENT_USER\SOFTWARE\PAD", "Target")
if $targetcheck = "" then
$targetreg = @MyDocumentsDir
else
$targetreg = $targetcheck
endif

$parent = GUICreate($name,425,100,-1,-1,-1, $WS_EX_ACCEPTFILES)
Opt("RunErrorsFatal", 0)
$contextmenu = GUICtrlCreateContextMenu ()
$fileopt = GUICtrlCreateMenu ("&File")
$exititem = GUICtrlCreateMenuitem ("Exit",$fileopt)
$helpopt = GUICtrlCreateMenu ("About")
$aboutitem = GUICtrlCreateMenuitem ("About",$helpopt)

GuiCtrlCreateLabel("Save Files To:",10,10,75,25)
$target = GUICtrlCreateInput($targetreg,90,5,325,20)
$download = GUICtrlCreateButton ("Download",20,40,75,25)
$setpath = GUICtrlCreateButton ("Set Path",100,40,75,25)
$about = GUICtrlCreateButton ("?",300,40,25,25)
$close = GUICtrlCreateButton ("Close",330,40,75,25)

GUISetState()
Do
$msg = GUIGetMsg()

if $msg = $download then
RegWrite("HKEY_CURRENT_USER\SOFTWARE\PAD","Target","REG_SZ",GuiCtrlRead($target))
$sCode = _INetGetSource("http://www.comics.com/comics/pearls/index.html")
$sString = StringInStr($sCode,"pearls2007",1,1)
$imagename = StringMid($sCode,$sString,23)
if @WDAY = 1 then
$getpearls = InetGet("http://www.comics.com/comics/pearls/archive/images/" & $imagename,GuiCtrlRead($target) & "\Pearls-" & @YEAR & @MON & @MDAY & ".jpg",1,0)
if $getpearls = 1 then
$open = MsgBox(4,"Succes","Today's Pearls Before Swine has been saved to:" & @CR & GuiCtrlRead($target) & "\Pearls-" & @YEAR & @MON & @MDAY & ".jpg." & @CR & "Do you want to view it?")
if $open = 6 then
ShellExecute("Pearls-" & @YEAR & @MON & @MDAY & ".jpg","",GuiCtrlRead($target))
endif
elseif $getpearls = 0 then
MsgBox(64,"Failure","An error occurrd, please try again.")
endif
else
$getpearls = InetGet("http://www.comics.com/comics/pearls/archive/images/" & $imagename,GuiCtrlRead($target) & "\Pearls-" & @YEAR & @MON & @MDAY & ".gif",1,0)
if $getpearls = 1 then
$open = MsgBox(4,"Succes","Today's Pearls Before Swine has been saved to:" & @CR & GuiCtrlRead($target) & "\Pearls-" & @YEAR & @MON & @MDAY & ".gif." & @CR & "Do you want to view it?")
if $open = 6 then
ShellExecute("Pearls-" & @YEAR & @MON & @MDAY & ".gif","",GuiCtrlRead($target))
endif
elseif $getpearls = 0 then
MsgBox(64,"Failure","An error occurrd, please try again.")
endif
endif
endif

if $msg = $setpath then
RegWrite("HKEY_CURRENT_USER\SOFTWARE\PAD","Target","REG_SZ",GuiCtrlRead($target))
endif

if $msg = $aboutitem or $msg = $about then
$child1 = GUICreate("About",220, 220,-1,-1,-1,$WS_EX_ACCEPTFILES,$parent)
$font = "Ariel"
Opt("RunErrorsFatal", 0)
GUICtrlCreateLabel ($name, 50, 30, 150,30)
GUICtrlSetFont (-1,10, 400, $font)
GUICtrlCreateIcon("icons\pearls.ico",-1,85,60,48,48)
GUICtrlCreateLabel ("Written By MaQleod",  55, 120, 150,30)
GUICtrlSetFont (-1,10, 400, $font)
$aboutok = GUICtrlCreateButton ("OK", 75, 170, 75,25)
GUISetState()
Do
$msg1 = GUIGetMsg()
if $msg1 = $aboutok then
ExitLoop
endif
Until $msg1 = $GUI_EVENT_CLOSE
GUIDelete($child1)
endif

if $msg = $close or $msg = $exititem then
ExitLoop
endif

Until $msg = $GUI_EVENT_CLOSE
GUIDelete()

[u]You can download my projects at:[/u] Pulsar Software

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0