this-is-me Posted September 28, 2004 Posted September 28, 2004 (edited) I got fed up with my comics by email because I would have to pay to get more than just one per day. Therefore, I made a program that just downloads the ones I need, and shows them. I am sure there are more out there, but most of them rely on the dates and so on being the same as the name of the gif or jpeg used for the strip. My script actually looks for what's on the page, and parses it. That way, if something changes, the script will still work.Here we go:expandcollapse popup#include "imgsize.au3" opt("Trayicondebug", 1) $cur = 1 $comicscom = "comics/arlonjanis:Arlo and Janis|_ creators/bc:BC|_ creators/heathcliff:HeathCliff|_ comics/bornloser:Born Loser|_ comics/dilbert:Dilbert|_ comics/franknernest:Frank and Ernest|_ comics/marmaduke:Marmaduke|_ comics/roseisrose:Rose Is Rose|_ wash/cheapthrills:Cheap Thrills Quisine|_ comics/drabble:Drabble|_ comics/frazz:Frazz|_ comics/jestsports:Jest Sports|_ comics/kitncarlyle:Kit and Carlyle|_ comics/offthemark:Off the Mark" $rbmacom = "Baby_Blues|_ Barney_Google|_ Beetle_Bailey|_ Better_Half|_ Blondie|_ Family_Circus" $ucomics="foxtrot:FoxTrot|_ garfield:Garfield|_ cathy:Cathy|_ ziggy:Ziggy" ;forbetterorforworse|_ $outdir = @ScriptDir & "\" & @MON & @MDAY & @YEAR DirRemove($outdir, 1) DirCreate($outdir) FileInstall("wget.exe", @TempDir & "\wget.exe") $comspl = StringSplit($comicscom, "|") for $a = 1 to $comspl[0] $conv = StringSplit($comspl[$a], ":") $loc = $conv[1] $nm = $conv[2] $tmpfile = @TempDir & "comic.tmp" ToolTip('Downloading "http://www.comics.com/' & $loc & '"') InetGet("http://www.comics.com/" & $loc, $tmpfile, 1) if Not @error Then $spl = StringSplit(FileRead($tmpfile, FileGetSize($tmpfile)), @LF) for $i = 1 to $spl[0] if StringInStr($spl[$i], "ALT=""Today's") Then $pos = StringInStr($spl[$i],'<img src="',0 , -1) $str = StringRight($spl[$i], StringLen($spl[$i]) - $pos - 9) $pos2 = StringInStr($str, '"') $str2 = StringLeft($str, $pos2 - 1) $url = $str2 if StringLeft($str2, 1) = "/" Then $url = "http://www.comics.com" & $str2 $outfile = $outdir & "\" & $nm & ".gif" if StringInStr($url, ".jpg") Then $outfile = $outdir & "\" & $nm & ".jpg" $cur = $cur + 1 ToolTip('Downloading "' & $url & '"') URLDownloadToFile($url, $outfile) EndIf Next EndIf Next $comspl = StringSplit($rbmacom, "|") for $a = 1 to $comspl[0] ToolTip('Downloading "' & $comspl[$a] & '"') RunWait(@TempDir & '\wget.exe --referer=http://www.kingfeatures.com/ http://est.rbma.com/content/' & $comspl[$a] & '?date=' & @YEAR & @MON & @MDAY & ' -O "' & $outdir & '\' & StringReplace($comspl[$a], "_", " ") & '.gif"', "", @SW_HIDE) $cur = $cur + 1 ;URLDownloadToFile("http://est.rbma.com/content/" & $loc & "?date=" & @YEAR & @MON & @MDAY, $outdir & "\" & $cur & ".gif") Next $comspl = StringSplit($ucomics, "|") for $a = 1 to $comspl[0] $conv = StringSplit($comspl[$a], ":") $loc = $conv[1] $nm = $conv[2] $tmpfile = @TempDir & "comic.tmp" ToolTip('Downloading "http://www.ucomics.com/' & $loc & '"') InetGet("http://www.ucomics.com/" & $loc, $tmpfile, 1) if Not @error Then $spl = StringSplit(FileRead($tmpfile, FileGetSize($tmpfile)), @LF) for $i = 1 to $spl[0] $pos = StringInStr($spl[$i], '<img src="http://images.ucomics.com/comics/') if $pos <> 0 Then $str = StringTrimLeft($spl[$i], $pos + 9) $pos2 = StringInStr($str, '"') $url = StringLeft($str, $pos2 - 1) $outfile = $outdir & "\" & $nm & ".gif" if StringInStr($url, ".jpg") Then $outfile = $outdir & "\" & $nm & ".jpg" $cur = $cur + 1 ToolTip('Downloading "' & $url & '"') URLDownloadToFile($url, $outfile) #ce EndIf Next EndIf Next FileDelete(@TempDir & "\wget.exe") $hdr = "" $mid = "" $search = FileFindFirstFile($outdir & "\*.*") If $search <> -1 Then While 1 $file = FileFindNextFile($search) if $file = "." or $file = ".." Then ContinueLoop If @error Then ExitLoop $arr = _GetImageSize($outdir & "\" & $file) if not @error Then if $arr[0] < 400 Then $hdr = $hdr & '<br><br>' & StringTrimRight($file, 4) & '<br><img src="' & $outdir & "\" & $file & '">' Else $mid = $mid & '<br><br>' & StringTrimRight($file, 4) & '<br><img src="' & $outdir & "\" & $file & '">' EndIf Else $mid = $mid & '<br><br>' & StringTrimRight($file, 4) & '<br><img src="' & $outdir & "\" & $file & '">' EndIf Wend FileClose($search) EndIf FileWrite($outdir & "\view.htm", $hdr & $mid) shellexecute($outdir & "\view.htm", "", 0) func shellexecute($file, $verb, $wait) local $oldopt = opt("expandenvstrings", 0) $ext = StringTrimLeft($file, StringInStr($file, ".", 0, -1)) $fltp = RegRead("HKEY_CLASSES_ROOT\." & $ext, "") if @error Then $fltp = $ext & "file" $defverb = RegRead("HKEY_CLASSES_ROOT\" & $fltp & "\shell", "") if $defverb = "" Then $defverb = "Open" if $verb = "" Then $cmd = RegRead("HKEY_CLASSES_ROOT\" & $fltp & "\shell\" & $defverb & "\command", "") Else $cmd = RegRead("HKEY_CLASSES_ROOT\" & $fltp & "\shell\" & $verb & "\command", "") EndIf if @error Then $cmd = RegEnumKey("HKEY_CLASSES_ROOT\" & $fltp & "\shell", 1) if @error Then Return 2 EndIf $cmd = StringReplace($cmd, "%l", FileGetLongName($file)) $cmd = StringReplace($cmd, "%1", $file) $cmd = StringReplace($cmd, "%*", "") for $i = 2 to 9 $cmd = StringReplace($cmd, "%" & $i, "") Next ;Why do I have to do this instead of expandenvstrings? $env = StringInStr($cmd, "%", 0, 1) if not @error Then for $i = 1 to 5 Step 2 if not StringInStr($cmd, "%", 0, $i) Then ExitLoop $envx = StringMid($cmd, StringInStr($cmd, "%", 0, $i) + 1, StringInStr($cmd, "%", 0, $i + 1) - 2) $cmd = StringReplace($cmd, "%" & $envx & "%", EnvGet($envx)) Next EndIf if $wait Then RunWait($cmd) Else Run($cmd) EndIf opt("expandenvstrings", $oldopt) endfuncHave over 20 comics in your face in the morning. This script is also customizable to download any comics from ucomics.com, comics.com, or kingfeatures.com Just change the variables accordingly.You will need to also download wget.exe from http://unxutils.sourceforge.net/ or google it if you don't want to get the whole package. The imgsize.au3 udf from larry is here: http://www.autoitscript.com/forum/index.ph...opic=4159&st=15EDIT: Updated to compile the target page with a better look Edited September 28, 2004 by this-is-me Who else would I be?
Guest Guidosoft Posted September 28, 2004 Posted September 28, 2004 Neato!!! WAY TO GO!!! THIS-IS-ME!!!!!!!
Guest BL@(K-R34P3R Posted September 28, 2004 Posted September 28, 2004 I've never been into comics Oo
dwelcher Posted November 27, 2004 Posted November 27, 2004 Anyone know how to get the comics they won't show? You know the ones you have to join for? Like Bloom County. I love this script! Thanks, -Dw --- Just don't tell the asylum you saw me here
this-is-me Posted November 27, 2004 Author Posted November 27, 2004 Excuse me? Did you follow all the instructions? Who else would I be?
dwelcher Posted November 28, 2004 Posted November 28, 2004 Excuse me? Did you follow all the instructions?<{POST_SNAPBACK}>Oh man! Now I feel stupid. I didn't see the instructions. I still can't. (I know I'm gonna get it ...)Take care,-Dw--- Everything in our favor was against us.
this-is-me Posted November 28, 2004 Author Posted November 28, 2004 You need to put the imgsize.au3 and wget.exe both in the same folder as my script. Then just run it. Who else would I be?
dwelcher Posted November 29, 2004 Posted November 29, 2004 You need to put the imgsize.au3 and wget.exe both in the same folder as my script. Then just run it.<{POST_SNAPBACK}> Okay, thanks for that. I didn't state my question very well. I have the script working, and have added many cartoons. The script is very well done and easy to adapt.On the website ucomics.com, they have some comics where they only put sample comics on the corresponding page. As opposed to having today's comic on that page. Bloom County and the Wizard of Id are a few examples.I guess my question is if anyone had found how to get those comics. Sorry about the misunderstanding.As I said, the script is great. Good piece of coding.Take care,-Dw--- The secret of success is sincerity. Once you can fake that, you have it made.
this-is-me Posted November 29, 2004 Author Posted November 29, 2004 (edited) Give me an example url and I can point you in the right direction. Edited November 29, 2004 by this-is-me Who else would I be?
dwelcher Posted November 29, 2004 Posted November 29, 2004 Give me an example url and I can point you in the right direction.<{POST_SNAPBACK}>Okay, here is one of them:http://www.ucomics.com/bloomcounty/Thanks,-Dw--- I may be fat but you're ugly, and I can lose weight.
this-is-me Posted November 29, 2004 Author Posted November 29, 2004 Well I looked at the info, but it really does not look like there is a place where (without a password) these comics are downloadable. Sorry. Who else would I be?
dwelcher Posted November 30, 2004 Posted November 30, 2004 Well I looked at the info, but it really does not look like there is a place where (without a password) these comics are downloadable. Sorry.<{POST_SNAPBACK}>Okay, thanks for trying. The good thing is that you used three different comic providers. So a lot of times I can get the password protected Ucomics.com at Comics.com or KingFeatures.com.Take care,-Dw--- You have the right to remain silent. Anything you say will be misquoted, then used against you.
aria Posted March 5, 2008 Posted March 5, 2008 hmm not working --------------------------- AutoIt Error --------------------------- Line 109 (File "...Desktop\test\comics.au3"): func shellexecute($file, $verb, $wait) Error: Badly formatted "Func" statement. --------------------------- OK ---------------------------
James Posted March 5, 2008 Posted March 5, 2008 This was posted in 2004. We are now in 2008, AutoIt has changed alot since then, try and fix the problems. By the way, shellexecute is an inbuilt command. Blog - Seriously epic web hosting - Twitter - GitHub - Cachet HQ
Catdaddy Posted March 5, 2008 Posted March 5, 2008 CODE#include "imgsize.au3"opt("Trayicondebug", 1)$cur = 1$comicscom = "comics/arlonjanis:Arlo and Janis|creators/bc:BC|creators/heathcliff:HeathCliff|comics/bornloser:Born Loser|comics/dilbert:Dilbert|comics/franknernest:Frank and Ernest|comics/marmaduke:Marmaduke|comics/roseisrose:Rose Is Rose|wash/cheapthrills:Cheap Thrills Quisine|comics/drabble:Drabble|comics/frazz:Frazz|comics/jestsports:Jest Sports|comics/kitncarlyle:Kit and Carlyle|comics/offthemark:Off the Mark"$rbmacom = "Baby_Blues|Barney_Google|Beetle_Bailey|Better_Half|Blondie|Family_Circus"$ucomics="foxtrot:FoxTrot|garfield:Garfield|cathy:Cathy|ziggy:Ziggy";forbetterorforworse|_$outdir = @ScriptDir & "\" & @MON & @MDAY & @YEARDirRemove($outdir, 1)DirCreate($outdir)FileInstall("wget.exe", @TempDir & "\wget.exe")$comspl = StringSplit($comicscom, "|")for $a = 1 to $comspl[0] $conv = StringSplit($comspl[$a], ":") $loc = $conv[1] $nm = $conv[2] $tmpfile = @TempDir & "comic.tmp" ToolTip('Downloading "http://www.comics.com/' & $loc & '"') InetGet("http://www.comics.com/" & $loc, $tmpfile, 1) if Not @error Then $spl = StringSplit(FileRead($tmpfile, FileGetSize($tmpfile)), @LF) for $i = 1 to $spl[0] if StringInStr($spl[$i], "ALT=""Today's") Then $pos = StringInStr($spl[$i],'<img src="',0 , -1) $str = StringRight($spl[$i], StringLen($spl[$i]) - $pos - 9) $pos2 = StringInStr($str, '"') $str2 = StringLeft($str, $pos2 - 1) $url = $str2 if StringLeft($str2, 1) = "/" Then $url = "http://www.comics.com" & $str2 $outfile = $outdir & "\" & $nm & ".gif" if StringInStr($url, ".jpg") Then $outfile = $outdir & "\" & $nm & ".jpg" $cur = $cur + 1 ToolTip('Downloading "' & $url & '"') URLDownloadToFile($url, $outfile) EndIf Next EndIfNext$comspl = StringSplit($rbmacom, "|")for $a = 1 to $comspl[0] ToolTip('Downloading "' & $comspl[$a] & '"') RunWait(@TempDir & '\wget.exe --referer=http://www.kingfeatures.com/ http://est.rbma.com/content/' & $comspl[$a] & '?date=' & @YEAR & @MON & @MDAY & ' -O "' & $outdir & '\' & StringReplace($comspl[$a], "_", " ") & '.gif"', "", @SW_HIDE) $cur = $cur + 1 ;URLDownloadToFile("http://est.rbma.com/content/" & $loc & "?date=" & @YEAR & @MON & @MDAY, $outdir & "\" & $cur & ".gif")Next$comspl = StringSplit($ucomics, "|")for $a = 1 to $comspl[0] $conv = StringSplit($comspl[$a], ":") $loc = $conv[1] $nm = $conv[2] $tmpfile = @TempDir & "comic.tmp" ToolTip('Downloading "http://www.ucomics.com/' & $loc & '"') InetGet("http://www.ucomics.com/" & $loc, $tmpfile, 1) if Not @error Then $spl = StringSplit(FileRead($tmpfile, FileGetSize($tmpfile)), @LF) for $i = 1 to $spl[0] $pos = StringInStr($spl[$i], '<img src="http://images.ucomics.com/comics/') if $pos <> 0 Then $str = StringTrimLeft($spl[$i], $pos + 9) $pos2 = StringInStr($str, '"') $url = StringLeft($str, $pos2 - 1) $outfile = $outdir & "\" & $nm & ".gif" if StringInStr($url, ".jpg") Then $outfile = $outdir & "\" & $nm & ".jpg" $cur = $cur + 1 ToolTip('Downloading "' & $url & '"') URLDownloadToFile($url, $outfile) #ce EndIf Next EndIfNextFileDelete(@TempDir & "\wget.exe")$hdr = ""$mid = ""$search = FileFindFirstFile($outdir & "\*.*") If $search <> -1 Then While 1 $file = FileFindNextFile($search) if $file = "." or $file = ".." Then ContinueLoop If @error Then ExitLoop $arr = _ImageGetSize($outdir & "\" & $file) if not @error Then if $arr[0] < 400 Then $hdr = $hdr & '<br><br>' & StringTrimRight($file, 4) & '<br><img src="' & $outdir & "\" & $file & '">' Else $mid = $mid & '<br><br>' & StringTrimRight($file, 4) & '<br><img src="' & $outdir & "\" & $file & '">' EndIf Else $mid = $mid & '<br><br>' & StringTrimRight($file, 4) & '<br><img src="' & $outdir & "\" & $file & '">' EndIf Wend FileClose($search)EndIfFileWrite($outdir & "\view.htm", $hdr & $mid)bshellexecute($outdir & "\view.htm", "", 0)func bshellexecute($file, $verb, $wait) local $oldopt = opt("expandenvstrings", 0) $ext = StringTrimLeft($file, StringInStr($file, ".", 0, -1)) $fltp = RegRead("HKEY_CLASSES_ROOT\." & $ext, "") if @error Then $fltp = $ext & "file" $defverb = RegRead("HKEY_CLASSES_ROOT\" & $fltp & "\shell", "") if $defverb = "" Then $defverb = "Open" if $verb = "" Then $cmd = RegRead("HKEY_CLASSES_ROOT\" & $fltp & "\shell\" & $defverb & "\command", "") Else $cmd = RegRead("HKEY_CLASSES_ROOT\" & $fltp & "\shell\" & $verb & "\command", "") EndIf if @error Then $cmd = RegEnumKey("HKEY_CLASSES_ROOT\" & $fltp & "\shell", 1) if @error Then Return 2 EndIf $cmd = StringReplace($cmd, "%l", FileGetLongName($file)) $cmd = StringReplace($cmd, "%1", $file) $cmd = StringReplace($cmd, "%*", "") for $i = 2 to 9 $cmd = StringReplace($cmd, "%" & $i, "") Next;Why do I have to do this instead of expandenvstrings? $env = StringInStr($cmd, "%", 0, 1) if not @error Then for $i = 1 to 5 Step 2 if not StringInStr($cmd, "%", 0, $i) Then ExitLoop $envx = StringMid($cmd, StringInStr($cmd, "%", 0, $i) + 1, StringInStr($cmd, "%", 0, $i + 1) - 2) $cmd = StringReplace($cmd, "%" & $envx & "%", EnvGet($envx)) Next EndIf if $wait Then RunWait($cmd) Else Run($cmd) EndIf opt("expandenvstrings", $oldopt)endfunc
Catdaddy Posted March 5, 2008 Posted March 5, 2008 Above is this script with the proper updated revisions. At least it works for me. Kudos to original author.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now