LinuxPizza

vbs

With great power comes great responsibility, so let's abuse our power we have as sysadmin in the companies we work for!

I do assume that your colleagues have a sense of humor!

Randomly let the computer talk

This script let the computer say “good morning” from the speaker, with a minimal interval of 20, and maximum of 360 minutes.

Set sapi=CreateObject("sapi.spvoice") 
randomize 
message = "good morning"
max=360 
min=20
skew=Int( ( max-min + 1) * Rnd + min) 
wscript.sleep(skew * 5 * 60000) 
do 
sapi.Speak message 
skew=Int( ( max-min + 1) * Rnd + min) 
wscript.sleep(skew * 60000) 
loop

Eject the CD-ROM drive once every 3000 seconds

Set oWMP = CreateObject("WMPlayer.OCX.7" )
Set ArrCDROM = oWMP.cdromCollection
while (1)
wscript.sleep 3000
ArrCDROM.Item(0).Eject
wscript.sleep 3000
ArrCDROM.Item(0).Eject
wend

This script changes that playing song on spotify

Set WshShell = WScript.CreateObject("WScript.Shell")
  ' spotify or user_id_number if playlist is private. ID can be found by using Spotify's Share button
  WshShell.Run "spotify:user:<spotify/user_id_number>:playlist:<playlist_code>", 3, false
WScript.sleep 20000
  ' Change active Window
WshShell.AppActivate "Spotify"
  ' Start playing selected queue
WshShell.SendKeys " "
  ' Focus?
WshShell.SendKeys "{ENTER}"
WScript.sleep 100
  ' Shuffle play next track
WshShell.SendKeys "^{RIGHT}"
WScript.Quit 0

EDIT: Apparently this does not work anymore, since Spotify has removed the API.

Not really the typical “Linux Sysadmin things” this time, but if you work as a sysadmin at a company – this can be gold! If you have any other ones, let me know and I will add them here and credit you :)

#vbs #windows