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

    Playing music in the background while another task is running VBS Script

    Computing StaffBy Computing StaffSeptember 23, 2021
    Twitter LinkedIn Email Telegram
    Playing music in the background while another task is running VBS Script
    Twitter LinkedIn Email Telegram
    Sometimes some tasks can be taken a lot of time to end up.
    This vbscript is created in order to play a random radio music in background while the script is running another task until to finish up and the music will stop too.
    '**********************************Description in English***********************************
    'This vbscript is created by Hackoo on 29/09/2019  
    'Sometimes some tasks can be taken a lot of time to end up.  
    'This code is created in order to play music in background while the script is running another  
    'task until to finish up and the music will stop too.  
    'So, the user can listen to the music playing while the script is running another task.  
    '**********************************Description en Français**********************************  
    'Parfois, certaines tâches peuvent prendre beaucoup de temps pour finir.  
    'Ceci est créé afin de jouer de la musique en arrière-plan pendant que,  
    'le script exécute une autre tâche jusqu’à la terminer et la musique s’arrêtera aussi.  
    'Ainsi, l'utilisateur peut écouter la musique pendant que le script exécute une autre tâche.  
    '*******************************************************************************************  
    Option Explicit  
    If AppPrevInstance() Then   
    	MsgBox "The script is already Running" & vbCrlf &_  
    	CommandLineLike(WScript.ScriptName),VbExclamation,"The script is already Running"      
    	WScript.Quit    
    Else  
    	Call Run_as_Admin()  
    	Dim Title,EndUP,WS,fso,Temp,WSF_File,URL_Music,CMD,Process_Music,StartTime,Duration  
    	Title = "Playing music while another task is running by "& Chr(169) &" Hackoo 2019"  
    	EndUP = False  
    	Set WS = CreateObject("wscript.Shell")  
    	Set fso = CreateObject("Scripting.FileSystemObject")  
    	Temp = WS.ExpandEnvironmentStrings("%Temp%")  
    	WSF_File = Temp & "\Music.wsf"  
    	URL_Music = Random_Music  
    	Call Create_WSF_Music_File()  
    	CMD = "wscript.exe " & DblQuote(WSF_File) & " //job:PlayMusic "& DblQuote(URL_Music) &""  
    	Set Process_Music = WS.Exec(cmd)  
    	WS.Popup "Playing this Radio music "& DblQuote(URL_Music) & vbCrlf &_  
    	"in the background while the script is running another task until to finish it"_  
    	,5,Title,vbInformation + vbSystemModal  
    	Do While Process_Music.Status = 0  
    		If EndUP = False Then  
    '**********************************************************************************************************************  
    'Your Main Code goes Here  
    StartTime = Timer  
    Call RUN_CMD ( _  
    			"echo.>%Tmp%\LogCMD.txt" &_  
    			"& (Tracert.exe www.codereview.stackexchange.com" &_  
    			"& Ping www.codereview.stackexchange.com" &_  
    			"& Tracert.exe www.google.com" &_  
    			"& Ping www.google.com" &_  
    			"& NetStat -abnof)>>%Tmp%\LogCMD.txt" &_  
    			"& Start /MAX %Tmp%\LogCMD.txt"_  
    			)  
    			Duration = FormatNumber(Timer - StartTime, 0)  
    			WS.Popup "The task had taken a run time until its completion about :" & vbCrlf &_  
    			vbTab & convertTime(Duration) & vbCrlf & _  
    			vbTab & WScript.ScriptName,10,Title,vbExclamation + vbSystemModal  
    '**********************************************************************************************************************  
    		Else  
    			On Error Resume Next  'to ignore "invalid window handle" errors  
    			Process_Music.Terminate  
    			On Error Goto 0  
    			EndUP = True  
    		End If  
    	Loop  
    End If  
    '----------------------------------------------------------------------------------------  
    Sub Create_WSF_Music_File()  
    	Dim oWSF  
    	Set oWSF = fso.OpenTextFile(WSF_File,2,True)  
    	oWSF.WriteLine ""  
    	oWSF.WriteLine 	" language=""Vbscript"">"  
    	oWSF.WriteLine 	"Dim URL_Music"  
    	oWSF.WriteLine 	"URL_Music = WScript.Arguments(0)"  
    	oWSF.WriteLine 	"Call Play(URL_Music)"  
    	oWSF.WriteLine "Function Play(URL)"  
    	oWSF.WriteLine 	"Dim Sound"  
    	oWSF.WriteLine 	"Set Sound = CreateObject(""WMPlayer.OCX"")"                 
    	oWSF.WriteLine 	"Sound.URL = URL"  
    	oWSF.WriteLine 	"Sound.settings.volume = 100"                                 
    	oWSF.WriteLine 	"Sound.Controls.play"                                       
    	oWSF.WriteLine 	"Do while Sound.currentmedia.duration = 0"                  
    	oWSF.WriteLine 		"wscript.sleep 100"                                         
    	oWSF.WriteLine 	"Loop"    
    	oWSF.WriteLine "End Function"  
    	oWSF.WriteLine 	""  
    	oWSF.WriteLine ""  
    End Sub  
    '----------------------------------------------------------------------------------------  
    Function DblQuote(Str)  
    	DblQuote = Chr(34) & Str & Chr(34)  
    End Function  
    '----------------------------------------------------------------------------------------  
    Function RUN_CMD(StrCmd)  
    	Dim ws,MyCmd,Result  
    	Set ws = CreateObject("wscript.Shell")   
    	MyCmd = "CMD /C " & StrCmd & " "  
    	Result = ws.run(MyCmd,0,True)  
    	EndUP = True  
    End Function  
    '----------------------------------------------------------------------------------------  
    Function Random_Music()  
    	Dim URL1,URL2,URL3,URL4,URL5,URL6,ListMusic,i,j,tmp  
    	URL1 = "http://94.23.221.158:9197/stream"  
    	URL2 = "http://www.chocradios.ch/djbuzzradio_windows.mp3.asx"  
    	URL3 = "http://vr-live-mp3-128.scdn.arkena.com/virginradio.mp3"  
    	URL4 = "http://185.52.127.168/fr/30201/mp3_128.mp3?origine=fluxradios"  
    	URL5 = "http://icecast.skyrock.net/s/natio_mp3_128k"  
    	URL6 = "http://185.52.127.173/fr/30601/mp3_128.mp3?origine=tunein"  
    	ListMusic = array(URL1,URL2,URL3,URL4,URL5,URL6)  
    	Randomize  
    	For i = 0 To UBound(ListMusic)  
    		j = Int((UBound(ListMusic) - i + 1) * Rnd + i)  
    		tmp = ListMusic(i)  
    		ListMusic(i) = ListMusic(j)  
    		ListMusic(j) = tmp  
    	Next    
    	Random_Music=tmp  
    End Function  
    '----------------------------------------------------------------------------------------  
    Function AppPrevInstance()  
    	With GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\.\root\cimv2")    
    		With .ExecQuery("SELECT * FROM Win32_Process WHERE CommandLine LIKE " & CommandLineLike(WScript.ScriptFullName) & _  
    			" AND CommandLine LIKE '%WScript%' OR CommandLine LIKE '%cscript%'")  
    			AppPrevInstance = (.Count > 1)  
    		End With  
    	End With  
    End Function      
    '----------------------------------------------------------------------------------------  
    Function CommandLineLike(ProcessPath)  
    	ProcessPath = Replace(ProcessPath, "\", "\\")  
    	CommandLineLike = "'%" & ProcessPath & "%'"   
    End Function  
    '----------------------------------------------------------------------------------------  
    Function convertTime(seconds)  
    	Dim ConvSec,ConvHour,ConvMin  
       ConvSec = seconds Mod 60  
       If Len(ConvSec) = 1 Then  
             ConvSec = "0" & ConvSec  
       End If  
       ConvMin = (seconds Mod 3600) \ 60  
       If Len(ConvMin) = 1 Then  
             ConvMin = "0" & ConvMin  
       End If  
       ConvHour =  seconds \ 3600  
       If Len(ConvHour) = 1 Then  
             ConvHour = "0" & ConvHour  
       End If  
       convertTime = ConvHour & ":" & ConvMin & ":" & ConvSec  
    End Function  
    '----------------------------------------------------------------------------------------  
    Sub 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  
    End Sub  
    '----------------------------------------------------------------------------------------
    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.