I have successfully managed to use VBS to open cmd
for writing data to a database and pressing Enter key twice.
Here is my code:
Set wshshell = wscript.CreateObject("WScript.Shell")
Wshshell.run "cmd"
wscript.sleep 100
wshshell.sendkeys "firebase-import --service_account C:\Users --database_url https://firebaseio.com --json C:\Users\Zed\testing.json"
wscript.sleep 100
WshShell.SendKeys "{ENTER}"
WshShell.SendKeys "{ENTER}"
Here is the console output:
firebase-import --service_account C:\Users\Zed\private-firebase-adminsdk-private --path /Jobs/Test --database_url https://private.firebaseio.com --json C:\Users\Zed\testing.json
All data at https://private.firebaseio.com/Jobs/Test will be overwritten.
Press <enter> to proceed, Ctrl-C to abort.
Reading C:\Users\Zed\testing.json... (may take a minute)
Preparing JSON for import... (may take a minute)
Importing [==================================================] 100% (1/1)
Import completed.
I have also managed to play a sound using VBS. Here is the code:
Dim oPlayer
Set oPlayer = CreateObject("WMPlayer.OCX")
' Play audio
oPlayer.URL = "C:\Users\Zed\notify.mp3"
oPlayer.controls.play
While oPlayer.playState <> 1 ' 1 = Stopped
WScript.Sleep 100
Wend
' Release the audio file
oPlayer.close
Now, how to combine these two, so the sound only plays when Import completed
message is shown in the console window?