Sign in to follow this  
Followers 0
James

Garfield Reader

9 posts in this topic

#1 ·  Posted (edited)

Hey,

Ivan(i542) sent me this and I asked if I could edit it a bit. I then asked if I could post in his name. He said yes.

Basically, this will download a garfield comic. You need to make sure that the date is set correctly in your settings.

#include <GUIConstants.au3>
Kernel()

Func Kernel()
    MsgBox(0, "About", "Created by i542. Edited by JamesB" & @CRLF & "Garfield (c) Jim Davis (See http://www.garfield.com)" & @CRLF & @CRLF & "Version: 1.0 Alpha" & @CRLF & "Updates on www.i542.net")
    $TodayComicAddress = "http://images.ucomics.com/comics/ga/" & @YEAR & "/ga" & StringTrimLeft(String(@YEAR), 2) & @MON & @MDAY & ".gif"
    ProgressOn("Garfield Reader", "Downloading Garfield Comic Strip", "0 percent")
    $iSize = InetGetSize($TodayComicAddress)
    InetGet($TodayComicAddress, "C:\Garfield.gif", 0, 1)
    $iTemp = -1
    Do
        $iPCent = int(@InetGetBytesRead/$iSize*100)
        If $iPCent <> $iTemp Then ProgressSet($iPCent, $iPCent & "%") ;prevent flicker
        $iTemp = $iPCent
    Until Not @InetGetActive
    ProgressSet(100, "Done", "Download complete! Garfield comic downloaded!")
    Sleep(1000)
    ProgressOff()
    If @WDAY = 1 Then
        MainBig()
    Else
        MainSmall()
    EndIf
EndFunc   ;==>Kernel

Func MainSmall()
    $gui = GUICreate("Garfield Reader", 614, 230, 193, 115, BitOR($WS_CAPTION, $WS_BORDER, $WS_CLIPSIBLINGS))
    $garfield = GUICtrlCreatePic("", 6, 7, 600, 177, BitOR($SS_NOTIFY, $WS_GROUP))
    GUICtrlSetImage(-1, "C:\Garfield.gif")
    $save = GUICtrlCreateButton("Save in file", 5, 195, 75, 25, 0)
    $quit = GUICtrlCreateButton("Quit", 533, 196, 75, 25, 0)
    GUICtrlCreateLabel("Garfield Reader by i542 & JamesB. Version 1.0 Alpha", 177, 200, 243, 17)
    GUICtrlSetState(-1, $WS_DISABLED)
    GUISetState(@SW_SHOW)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $quit
                Exit
            Case $save
                MsgBox(64, "Save Garfield", "This command will save Garfield to your HDD. Please refer http://www.garfield.com for distribution information")
                $path = FileSaveDialog("Save", @MyDocumentsDir, "Graphic Interchange Format (*.GIF)")
                If @error Then ContinueLoop
                FileCopy("C:\Garfield.gif", $path & ".gif")
        EndSwitch
    WEnd
EndFunc   ;==>MainSmall

Func MainBig()
    $gui = GUICreate("Garfield Reader", 751, 407, 193, 115, BitOR($WS_CAPTION, $WS_BORDER, $WS_CLIPSIBLINGS))
    $garfield = GUICtrlCreatePic("", 2, 1, 600, 398, BitOR($SS_NOTIFY, $WS_GROUP))
    GUICtrlSetImage(-1, "C:\Garfield.gif")
    $save = GUICtrlCreateButton("Save to disk", 616, 6, 75, 25, 0)
    $quit = GUICtrlCreateButton("Quit", 612, 377, 75, 25, 0)
    GUISetState(@SW_SHOW)

    While 1
        $nMsg = GUIGetMsg()
        Switch $nMsg
            Case $quit
                Exit
            Case $save
                MsgBox(64, "Save Garfield", "This command will save Garfield to your HDD. Please refer http://www.garfield.com for distribution information")
                $path = FileSaveDialog("Save", @MyDocumentsDir, "Graphic Interchange Format (*.GIF)")
                If @error Then ContinueLoop
                FileCopy("C:\Garfield.gif", $path & ".gif")
                GUICtrlSetImage(-1, "C:\Garfield.gif")
        EndSwitch
    WEnd
EndFunc   ;==>MainBig

-James & Ivan through MSN

Edited by JamesB

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Firstly, the script downloads the image 10 times, I believe the following is what was meant to happen:

$iSize = InetGetSize($TodayComicAddress)
    InetGet($TodayComicAddress, "C:\Garfield.gif", 0, 1)
    $iTemp = -1
    Do
        $iPCent = int(@InetGetBytesRead/$iSize*100)
        If $iPCent <> $iTemp Then ProgressSet($iPCent, $iPCent & "%") ;prevent flicker
        $iTemp = $iPCent
    Until Not @InetGetActive
Edited by RazerM

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

I like this, good job to the both of you!

EDIT: I put this in my startup, it's just like those little calendar things that have a joke on them...

Edited by Piano_Man

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

hahahha I LOVE IT!!! :)

Just awesome. Good Job.

Oh, I edited a bit so it deletes the pic from the C drive once you clik quit or after you save it.

Edited by Nahuel

Share this post


Link to post
Share on other sites

Hope you guys don't mind! I used your script and made a Calvin and Hobbes Reader! I changed the GUI a little bit too... I don't know if Calving and Hobbes in the "big size" but if they do it probably won't work right, but you can change that if it ever happens.

#noTrayIcon
#include <GUIConstants.au3>

Opt("GUIOnEventMode", 1)

Kernel()

While 1 
    Sleep(1000)
WEnd

Func Kernel()
    $TodayComicAddress = "http://images.ucomics.com/comics/ch/" & @YEAR & "/ch" & StringTrimLeft(@YEAR, 2) & @MON & @MDAY & ".gif"

    ProgressOn("Calving and Hobbes Reader", "Downloading...", "0%")
    $iSize = InetGetSize($TodayComicAddress)
    InetGet($TodayComicAddress, "C:\CalvinAndHobbes.gif", 0, 1)
    $iTemp = -1
    Do
        $iPCent = int(@InetGetBytesRead/$iSize*100)
        If $iPCent <> $iTemp Then ProgressSet($iPCent, $iPCent & "%");prevent flicker
        $iTemp = $iPCent
    Until Not @InetGetActive
    ProgressSet(100, "Complete", "Download successful!")
    Sleep(200)
    ProgressOff()
    If @WDAY = 1 Then
        MainBig()
    Else
        MainSmall()
    EndIf
EndFunc  ;==>Kernel

Func MainSmall()
    $gui = GUICreate("Calving and Hobbes Reader", 615, 226, -1, -1, $WS_SYSMENU, $WS_EX_TOOLWINDOW)
        GuiSetOnEvent($GUI_EVENT_CLOSE, '_Exit')
    $garfield = GUICtrlCreatePic("", 5, 5, 600, 189, BitOR($SS_NOTIFY, $WS_GROUP))
    GUICtrlSetImage(-1, "C:\CalvinAndHobbes.gif")

    GUISetState(@SW_SHOW)
EndFunc  ;==>MainSmall

Func MainBig()
    $gui = GUICreate("Calving and Hobbes Reader", 615, 430, -1, -1, $WS_SYSMENU, $WS_EX_TOOLWINDOW)
        GuiSetOnEvent($GUI_EVENT_CLOSE, '_Exit')
    $garfield = GUICtrlCreatePic("", 5, 5, 600, 398, BitOR($SS_NOTIFY, $WS_GROUP))
    GUICtrlSetImage(-1, "C:\CalvinAndHobbes.gif")

    GUISetState(@SW_SHOW)
EndFunc  ;==>MainBig

Func _Exit() 
    Exit 
EndFunc

My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]

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