December 20, 2010 12:48AM
Now i'm not a scripting guru at all, but i figured some things out that i wanted to share.
I know there are more people here reading this forum that would like some audio feedback while using Tazti.
A way to do this, is to create a Visual Basic Script and have it start the desired program and trigger some form of audio feedback.
Now simply have Tazti start your .vbs file and presto, your computer talks back at you.

There are 2 ways that i found to get you audio feedback.
You can either use a small commandline based mediaplayer and have it play a sound file.
Or you can use windows Text To Speech function and have it say whatever you want.

The way of the mediaplayer definetly gives better sound, but you will have to make an audio file for each and every feedback you want to get.
Where as the TTS (Text To Speech) method is way more flexible.

For the mediaplayer i downloaded a little program called "wv player". Just google it, you're sure to find it.

I'll just provide you with the code to use here, so you can just copy and paste it into a file make the, i think, obvious adjustments and your done.

So for the WV_Player mediaplayer script:

Dim oShell
Set oShell = WScript.CreateObject ("WScript.Shell"winking smiley
oShell.run "C:\Path\To\Program\Program.exe", 0, False
oShell.run "C:\Path\To\Mediaplayer\\wv_player.exe C:\Path\To\Mediafile\Audiofile.mp3", 0, False
Set oShell = Nothing


Copy and paste this into a texteditor and save the file as "MyFile.VBS"
Be carefull here that the extention is in fact .VBS, because notepad would save your file as "MyFile.VBS.txt" and this is not what you want, it won't work.

Now for the TTS way copy and paste this into a texteditor:

Dim oShell, Say
Set oShell = WScript.CreateObject ("WScript.Shell"winking smiley
oShell.run "C:\Path\To\Program\Program.exe", 0, False

Say = "Look, i got my PC talking back at me"
Set sapi=CreateObject("sapi.spvoice"winking smiley
sapi.Speak Say

Set oShell = Nothing


Just change the text "Look, i got my PC talking back at me" into whatever you want your script to say.

Like i said, i'm not a scripting guru, but if you run into trouble i will try to help.
Maybe there are some other people reading this that are scripting guru's and have a better way of doing this or helping other people.
Please let us know, i'm always interrested in learning more.

I already ran into some trouble with a more advanced script using commandline arguments.
This works great with Tazti API feature. You can create scripts with options and use the API feature to determin what options to use.

At first this didn't work at all.
The script was work fine, Tazti was working fine. The only thing that wasn't working fine was Tazti and the Script together.
This was because of me NOT being a scripting guru.

Now scripts are in fact text files with pieces of code. Your computer sees it as text and this text needs to be understood/interpreted.
This is where the commandinterpreter comes in.
With a simple piece of code windows just automaticly knows what to do with it and redirects it to the commandinterpreter.
When it get's more difficult you need to call upon the commandinterpreter yourself and have it run your script.
The commandinterpreter is a program called cscript.exe and it's usually located in C:\WINDOWS\system32

With simple scripts you can just have Tazti run the .vbs file you created, but when this doesn't work you should have Tazti run it as:

C:\WINDOWS\system32\cscript.exe C:\Path\To\Myfile\Myfile.vbs


Now i'm not sure if anybody is interested in this, but it took me a long time to figure out and i'm proud that it works so i'm gonna bore you with it anyway. If you don't like, just stop reading grinning smiley
I created this script file to play my music . What it does is take in artist and albumname as commandline arguments it than starts Winamp and that plays the album i gave as the command argument and it than says: "Now playing music by (artist). From the album (albumname)"

So this is the code:

Dim ArgCount, ProCount, Arg, Say, oShell, Sapi

ArgCount = WScript.Arguments.count
Arg = ""
Say = "Now playing music by "


For ProCount = 1 to ArgCount
Arg = Arg + WScript.Arguments.Item(ProCount-1)
If WScript.Arguments.Item(ProCount-1) <> "-" Then
Say = Say + " " + WScript.Arguments.Item(ProCount-1)
Else
If WScript.Arguments.Item(ProCount-1) = "-" Then
Say = Say + ". from the Album, "
Else
Wscript.Echo "Usage: Music.vbs Artist - Albumname"
End If
End If
If ProCount < ArgCount Then
Arg = Arg + " "
Else
End If
Next

Set sapi=CreateObject("sapi.spvoice"winking smiley
sapi.Speak Say

Arg = """Y:\Muziek\CD Albums\" + Arg
Arg = Arg + """"

Set oShell = WScript.CreateObject ("WScript.Shell"winking smiley
oShell.run "C:\Winamp\WinAmp.exe "&arg,0, False

Set oShell = Nothing
Wscript.Quit


The way i have Tazti start this file is using the API function, this starts the script and passes on the correct artist and albumname.
This is the way i start the file:
C:\Windows\System32\Cscript.exe E:\TaztiCommands\Music.vbs Artist - Albumname

Anyway, once again i hope this is usefull to at least 1 person and i hope it inspires to a whole lot of other ideas.

Grtz. Machrias

PS i've noticed that in the text you might see "winking smiley" this is meant to be " ) but without the space in between. The forum site sees this combination as a winking smiley.
Subject Author Views Posted

Creating your own audio feedback using .VBS scripts

Machrias 4936 December 20, 2010 12:48AM

Re: Creating your own audio feedback using .VBS scripts

Stu 1970 December 26, 2010 03:38PM



Sorry, only registered users may post in this forum.

Click here to login