Tuesday, 31 December 2013

AUTOMATIC DESKTOP BACKGROUND CHANGER (BING)

                                     
                                                     In this post I will be explaining how you can use Autoit's Internet Explorer Libraries to make an application that synchronizes your desktop background image with BING's homepage background image.



Here is the code to do this. Explanation given in comments in the code

;By placing the compiled exe version of this in your startup folder, 
;your desktop background automatically gets synchronized with the BING homepage's background image
;
;Here we include the libraries required
#include <IE.au3>
#include <INet.au3>
#include <String.au3>
;
;The following code snippet gets the source code of specified page in text format to the variable
;$sSource
Global $sSource = _INetGetSource("http://www.bing.com")
;The image url lies in between the strings 'g_img={url:' and ','
;you can check this by opening the source code of page in your browser
Global $aImgURL = _StringBetween($sSource, 'g_img={url:', ',')
;Creating a directory to store the images
;You can always change the below directory to where ever you wish to store
If Not FileExists("E:\desktopbg") Then DirCreate("E:\desktopbg")
;clearing the ''s to get the exact url
;to see what comes to $aImgURL[0] uncomment the next line and run it
;MsgBox(0,"",$aImgURL[0])
Global $stext = StringReplace($aImgURL[0], "'", "")
;
$stext1 =  StringReplace($stext,"/","\")
$sURL = "http://www.bing.com" & $stext
;spitting the url based on \ and getting the image name
$st1 = StringSplit($stext1,"\")
;$nn = size of array $st1
$nn = UBound($st1)
$kk = $st1[$nn-1]
;MsgBox(0,"",$kk)
;Destination image
Global $nFile="E:\desktopbg\" & $kk
;MsgBox(0,"",$nFile)
;Exit if no update
If FileExists($nFile) Then Exit'
;Download the image
InetGet($sURL,$nFile)
;
;Set it as your desktop background
Global $SPI_SETDESKWALLPAPER = 20
Global $SPIF_UPDATEINIFILE = 1
Global $SPIF_SENDCHANGE = 2
Global $REG_DESKTOP= "HKEY_CURRENT_USER\Control Panel\Desktop"
RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "TileWallPaper", "REG_SZ", 0)
RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "WallpaperStyle", "REG_SZ", 0)
RegWrite("HKEY_CURRENT_USER\Control Panel\Desktop", "Wallpaper", "REG_SZ", $nFile)
DllCall("user32.dll", "int", "SystemParametersInfo", _
"int", $SPI_SETDESKWALLPAPER, _
"int", 0, _
"str", $nFile, _
"int", BitOR($SPIF_UPDATEINIFILE, $SPIF_SENDCHANGE))
;
Exit

You can copy paste it in your editor or download it from here
Now you can simply convert this into .exe format by clicking build in your editor.
You can place this in your startug folder so that your desktop back ground changes whenever your system starts

Monday, 30 December 2013

Installing Autoit

i

AUTOIT

ABOUT:

              AutoIt v3 is a freeware BASIC-like scripting language designed for automating the Windows GUI and general scripting. It uses a combination of simulated keystrokes, mouse movement and window/control manipulation in order to automate tasks in a way not possible or reliable with other languages.

                              In short, it is a computer automation software for automating some of the works which require a lot of repeated procedures to be done manually like mouse clicks and keyboard strokes.

HOW TO INSTALL:


                    Well, its quite simple, just download the latest version from here. I would personally like to recommend the Self Extracting archive version by which you don't have to install it by running setup file or something else. Just extract all the files and that's it, you are done. Now you would be able to find a folder named SciTe inside the folder to which you have extracted it inside which you wold find an application with same name SciTE. SciTe is a SCIntilla based text editor. It is an useful editor with facilities for building and running programs. SO this is where you will get your programs written, built and debugged.
Powered by Blogger.

Blog Archive

 

© 2013 The Repository. All rights resevered. Designed by Templateism

Back To Top