Close Menu
Computing.net
    Facebook X (Twitter) Instagram
    Computing.netComputing.net
    • News
      1. AI
      2. Crypto
      3. Gaming
      4. Hardware
      5. Security
      6. Software
      7. View All

      Anthropic’s COBOL Automation Tool Triggers IBM Stock Plunge and Crypto Market Decline

      February 24, 2026

      AI Trading Bot Loses $441K in Crypto After Decimal Point Mistake

      February 23, 2026

      Tesla (TSLA) Stock: Goodbye Sedans, Hello Robots in Dramatic Production Shift

      January 29, 2026

      Palantir Technologies (PLTR) Stock: Why Bears May Be Wrong About Valuation Concerns

      January 29, 2026

      SUI Token Rallies 40% Following Major Staking Event and CME Futures Announcement

      May 12, 2026

      Chainlink (LINK) Surges to $10.40 as Network Activity Hits Eight-Month Peak

      May 12, 2026

      Dogecoin Whales Ramp Up Accumulation as DOGE Eyes Critical Breakout Levels

      May 12, 2026

      Bitcoin Holds $81K While Burry Flags Nasdaq Bubble and Oil Surges Past $105

      May 12, 2026

      Hamster Kombat: Unraveling TON’s Gaming Phenomenon

      August 7, 2024

      W-Coin: Exploring the Latest Telegram Tap-to-Earn Phenomenon

      August 7, 2024

      Hamster Kombat: 300 Million Players & Counting, HMSTR Token Airdrop Soon!

      July 31, 2024

      Hamster Kombat Developers Work with TON Team on Airdrop Solution

      July 30, 2024

      Nothing Expands Product Line with New AI Feature & Phone Update

      July 31, 2024

      Security Audit Reveals Concerns in Atari’s Blockchain Game on Base

      August 6, 2024

      SideWinder Group Targets Maritime Facilities in New Cyber Espionage Campaign

      July 30, 2024

      OAuth Implementation Flaw Exposes Millions of Websites to XSS Attacks

      July 30, 2024

      Hamster Kombat Players Face Growing Cybersecurity Threats

      July 25, 2024

      Anthropic’s COBOL Automation Tool Triggers IBM Stock Plunge and Crypto Market Decline

      February 24, 2026

      Cookie Crumble: Google Halts Plans to Eliminate Third-Party Cookies in Chrome

      July 23, 2024

      Big Brother is Watching: Apple’s Creepy New Ad Urges iPhone Users to Ditch Chrome

      July 23, 2024

      Nvidia Stock Soars to New Record at $219.44 Ahead of May 20 Earnings

      May 12, 2026

      Rocket Lab Shares Surge Past $120 Following Wave of Analyst Upgrades

      May 12, 2026

      GM Shares Decline Following 600 IT Layoffs Amid Strategic AI Workforce Transformation

      May 12, 2026

      SES Delivers €847M Q1 Performance as Intelsat Integration and Aviation Deals Fuel Expansion

      May 12, 2026
    • How To

      Batch Files: Tokens and Delimiters (FOR Loops)

      July 31, 2024

      Types of Ethernet Cabling & Electrical Low Voltage Wiring

      July 9, 2024

      What You Should Know About .JSON File Extension

      January 10, 2023

      Bkup File Extension

      November 19, 2022

      HEIC File Extension

      November 19, 2022
    • Office
      1. Excel
      2. Google Sheets
      3. View All

      How to Convert Column List to Comma Separated List in Excel

      July 24, 2024

      How to Find the Last Monday of the Month in Excel

      July 24, 2024

      Convert Bytes to MB or GB in Excel: 3 Methods!

      July 24, 2024

      How to Remove Characters from Right in Excel

      July 30, 2023

      How to Subtract in Google Sheets: Complete Guide

      July 31, 2024

      Bullet Points in Google Sheets

      January 20, 2022

      Sort by Date in Google Sheets

      January 18, 2022

      Google Sheets Timestamp

      January 17, 2022

      How to Subtract in Google Sheets: Complete Guide

      July 31, 2024

      How to Convert Column List to Comma Separated List in Excel

      July 24, 2024

      How to Find the Last Monday of the Month in Excel

      July 24, 2024

      Convert Bytes to MB or GB in Excel: 3 Methods!

      July 24, 2024
    • Answers
    • About
    • Contact
    Facebook X (Twitter)
    Computing.net
    How To

    [VBS] Daily Downloading NASA images to use as Windows wallpaper

    Computing StaffBy Computing StaffOctober 5, 2021
    Twitter LinkedIn Email Telegram
    Twitter LinkedIn Email Telegram

    Hi ????
    I created a vbscript that was inspired by a batch file (Daily Downloading NASA images to use as Windows wallpaper)

    So the vbscript try to download everyday a new picture and set it as wallpaper from here ==> Astronomy Picture of the Day.
    Examples :
    Option Explicit  
    'Vbscript created by Hackoo on 16/01/2020 inspired by this batch file  
    'https://codereview.stackexchange.com/questions/213724/download-nasa-images-to-use-as-windows-wallpaper/235545#235545  
    'Run as Admin  
    If Not WScript.Arguments.Named.Exists("elevate") Then  
       CreateObject("Shell.Application").ShellExecute DblQuote(WScript.FullName) _  
       , DblQuote(WScript.ScriptFullName) & " /elevate", "", "runas", 1  
        WScript.Quit  
    End If  
      
    Dim Title,BaseUrl,dte,URL,Ws,objFSO,Command,i,LogFile,strText,Img  
    Dim WinHttp,Data,ImgLink,strDirectory,sWallPaper,ID,FilePath,TaskName,Repeat_Task  
    Title = "Download Daily NASA image and set as Windows Wallpaper by Hackoo"  
    Set objFSO = CreateObject("Scripting.FileSystemObject")  
    Set Ws = CreateObject("WScript.Shell")  
    strDirectory = "Wallpaper"  
    strDirectory = objFSO.BuildPath(Ws.SpecialFolders("Desktop"), strDirectory)  
    If not objFSO.FolderExists(strDirectory) Then objFSO.CreateFolder(strDirectory)  
    LogFile = strDirectory & "\Wallpaper_Error_Log.txt"  
    BaseUrl="https://apod.nasa.gov/apod/"  
    dte = Right(Year(Now),2) & LPad(Month(Now),2,"0") & LPad(Day(Now),2,"0")  
    URL = BaseUrl & "ap" & dte &".html"  
    'wscript.echo url  
    FilePath = WScript.ScriptFullName  
    TaskName = "NASA"  
    Repeat_Task = 120  
    Call Create_Schedule_Task(Repeat_Task,TaskName,FilePath)  
    Set WinHttp = CreateObject("Microsoft.XmlHttp")  
    On error resume next  
    WinHttp.Open "GET", URL, False  
    WinHttp.send()  
      
    If Err Then Call WriteError()  
      
    If WinHttp.Status = 200 Then  
        If InStr(WinHttp.responseText,"embed") > 0 Then  
    		ID = ExtractMatch(WinHttp.responseText,"embed/([A-Za-z0-9-_]+)")  
    		ImgLink = "https://i.ytimg.com/vi/"& ID &"/maxresdefault.jpg" ' Get Image from Youtube video  
    		'wscript.echo ImgLink  
    		sWallPaper = strDirectory & "\YT_" & dte &".jpg"  
    		'ws.run ImgLink  
    		Call Download(ImgLink,sWallPaper)  
    		If objFSO.FileExists(sWallPaper) Then Call SetWallpaper(sWallPaper)  
    	Else  
    		Img = ExtractMatch(WinHttp.responseText,"<img.*?src=\x22(\w.+)\x22") imglink="BaseUrl" &="" img="" 'wscript.echo="" swallpaper="strDirectory" "\"="" dte="" "_"="" getfilenamefromdirectlink(imglink)="" call="" download(imglink,swallpaper)="" if="" objfso.fileexists(swallpaper)="" then="" setwallpaper(swallpaper)="" end="" else="" strtext="Get_Date_Time" vbtab="" &_="" "the="" wallpaper="" is="" not="" ready="" until="" now="" !"="" vbcrlf="" string(70,"-")="" writelog(strtext,logfile)="" wscript.quit(1)="" '-------------------------------------------------------------------------="" sub="" download(url,save2file)="" dim="" file,line,bs,ws="" on="" error="" resume="" next="" set="" file="CreateObject("Microsoft.XmlHttp")" file.open="" "get",url,="" false="" file.send()="" err.number="" <=""> 0 then  
    		Call WriteError()  
            MsgBox Line,vbCritical,"Error getting file"  
            Err.clear  
            wscript.quit  
        End If  
        If File.Status = 200 Then ' File exists and it is ready to be downloaded  
            Set BS = CreateObject("ADODB.Stream")  
            Set ws = CreateObject("wscript.Shell")  
            BS.type = 1  
            BS.open  
            BS.Write File.ResponseBody  
            BS.SaveToFile Save2File, 2  
        ElseIf File.Status = 404 Then  
            MsgBox "File Not found : " & File.Status,vbCritical,"Error File Not Found"  
        Else  
            MsgBox "Unknown Error : " & File.Status,vbCritical,"Error getting file"  
        End If  
    End Sub  
    '-------------------------------------------------------------------------  
    Sub SetWallpaper(sWallPaper)  
    ' Update in registry  
    ' Mise à jour dans le registre  
    Ws.RegWrite "HKCU\Control Panel\Desktop\Wallpaper", sWallPaper  
    ' Killing not responding processes  
    Ws.Run "CMD /C Taskkill /f /fi ""status eq not responding""",0,True  
    ' Let the system know about the change  
    ' Informer le système du changement  
    For i=0 to 2  
    	Ws.Run "RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", i, False  
    	Ws.Run "RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", i, False  
    	Ws.Run "RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", i, True  
    	Ws.Run "RUNDLL32.EXE user32.dll,UpdatePerUserSystemParameters", i, True  
    Next  
    End Sub  
    '-------------------------------------------------------------------------  
    Function ExtractMatch(Text,Pattern)  
        Dim Regex, Matches  
        Set Regex = New RegExp  
        Regex.Pattern = Pattern  
    	Regex.Global = True  
    	Regex.IgnoreCase = True   
        Set Matches = Regex.Execute(Text)  
        If Matches.Count = 0 Then  
            ExtractMatch = ""  
            Exit Function  
        End If  
        ExtractMatch = Matches(0).SubMatches(0)  
    End Function  
    '-------------------------------------------------------------------------  
    Function LPad(s, l, c)  
      Dim n : n = 0  
      If l > Len(s) Then n = l - Len(s)  
      LPad = String(n, c) & s  
    End Function  
    '-------------------------------------------------------------------------  
    Function GetFileNamefromDirectLink(URL)  
        Dim ArrFile,FileName  
        ArrFile = Split(URL,"/")  
        FileName = ArrFile(UBound(ArrFile))  
        GetFileNamefromDirectLink = FileName  
    End Function  
    '-------------------------------------------------------------------------  
    Function Dblquote(str)  
        Dblquote = chr(34) & str & chr(34)  
    End Function  
    '-------------------------------------------------------------------------  
    Sub WriteLog(strText,LogFile)  
        Dim fs,ts  
        Const ForAppending = 8  
        Set fs = CreateObject("Scripting.FileSystemObject")  
        Set ts = fs.OpenTextFile(LogFile,ForAppending,True)  
        ts.WriteLine strText  
        ts.Close  
    End Sub  
    '-------------------------------------------------------------------------  
    Function Get_Date_Time()  
    	Get_Date_Time = LPad(Day(Now),2,"0") & "/" & LPad(Month(Now),2,"0") & "/" & Year(Now) &_  
    	vbTab & LPad(Hour(Now),2,"0") & ":" & LPad(Minute(Now),2,"0")  & ":" & LPad(Second(Now),2,"0")  
    End Function  
    '-------------------------------------------------------------------------  
    Sub Create_Schedule_Task(Repeat_Task,TaskName,FilePath)  
    Dim Task,Result  
    Task = "CMD /C Schtasks /Create /SC DAILY /ST 08:00 /F /RI "&_  
    Repeat_Task &" /DU 24:00 /TN "& TaskName &" /TR "& FilePath &""  
    Result = Ws.run(Task,0,True)  
    End Sub  
    '-------------------------------------------------------------------------  
    Sub WriteError()  
    	Dim Line  
    	Line  = Get_Date_Time  
    	Line  = Line &  vbcrlf & "Error " & err.number & " (0x" & hex(err.number) & ") " & vbcrlf &_  
    	err.Description  
    	Line  = Line & "Source : " & err.Source  
    	WriteLog Line & vbcrlf & String(70,"-") , LogFile  
    	Err.clear  
    End Sub  
    '------------------------------------------------------------------------</img.*?src=\x22(\w.+)\x22")>
    For any update of this vbscript NASA_Wallpaper.vbs
    Share. Twitter LinkedIn Email Telegram
    Avatar photo
    Computing Staff
    • Website

    Related Posts

    Batch Files: Tokens and Delimiters (FOR Loops)

    July 31, 2024

    Types of Ethernet Cabling & Electrical Low Voltage Wiring

    July 9, 2024

    What You Should Know About .JSON File Extension

    January 10, 2023

    Bkup File Extension

    November 19, 2022

    HEIC File Extension

    November 19, 2022

    Working with Batch variables and For loops

    October 6, 2021
    Add A Comment

    Comments are closed.

    Latest

    Nvidia Stock Soars to New Record at $219.44 Ahead of May 20 Earnings

    May 12, 2026

    Rocket Lab Shares Surge Past $120 Following Wave of Analyst Upgrades

    May 12, 2026

    GM Shares Decline Following 600 IT Layoffs Amid Strategic AI Workforce Transformation

    May 12, 2026

    SES Delivers €847M Q1 Performance as Intelsat Integration and Aviation Deals Fuel Expansion

    May 12, 2026

    Trump Dismisses Iran Peace Proposal — Oil Markets React as Hormuz Remains Restricted

    May 12, 2026
    • Facebook
    • Twitter

    Latest Reviews

    Meta Platforms Shares Tumble 8% Despite Strong Q1 Performance Amid AI Investment Surge

    April 30, 2026

    Flush.com Review: Casino & Sportsbook With 275% Welcome Bonus

    March 7, 2026

    Katsubet Review: Crypto Casino With 300% Welcome Bonus & Free Spins

    March 7, 2026

    7Bit Review: Crypto Casino With 325% Bonus & 250 FS

    March 7, 2026

    Mega Dice Review: Crypto Casino With 200% Bonus & 50 Free Spins, Legit?

    March 7, 2026


    Home / Privacy Policy / Terms & Conditions

    Computing.net © 1996 - 2026 Kooc Media Ltd. All rights reserved. Registered Company No.05695741

    Type above and press Enter to search. Press Esc to cancel.