Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
I have a demo CD that I want to give out to people. It's an HTML using MS agent. The voice for the character animation is stored in numerous WAV files.
In working with agent technology, there are no editors/creators that will support variable or incomplete file paths.
(I.E.: Simple logic would have the html code look like this:)
Char.Speak "", "\vocals\speech1.wav"
or even
Char.Speak "", "%temp%\democd\vocals\speech1.wav"The scripting engines REQUIRE a full path, and web paths such as "/vocals/etc.." don't work. It has to actually read:
Char.Speak "", "D:\vocals\speech1.wav"
Herein lies the problem. Not everyone's CD drive is letter D. To get around this issue, I have decided to copy the contents of the CD into the temp folder of the user's computer,mostly because if we are to edit the HTML it cannot be on a CD.
Using the line:
FOR %%F IN (D E F G H I J K L M N O P Q R S T U V W X Y Z) DO (IF EXIST "%%F:\init.bat" (SET MYCD=%%F && CALL "%%F:\htmledit.cmd"))(where init.bat is defined in AUTORUN to find the CDrom letter and copy contents to %temp%, and htmledit.cmd is the batch that will handle the rewriting of the html file)
------------
Now that the variables are stored as %MYCD% and of course %TEMP%, how can I replace all 22 instances in the html file for the correct file path pointing to the users' temp folder?(Also considering that not all people will have C: as their system drive.)
Thanks in advance.

I am anything but a batch expert, but I have a couple of thoughts:
1. Batch does not have a "read in" capability, so reading in the HTML files and replacing something in them is out of the question. Nevertheless, dos does support sending the output of a command to a file, so you could potentially hard-code the html file within a batch file, and with something like
myfile.bat>>index.html
you could create the effect you wanted.2. If you did want to edit the html files, you could create a program to do it in C++ (or Java, if you require total platform compatability, as long as they have the JVM installed), then call that program from your batch file.
3. You could also just break down put these badboys on the web, then just have your batch file go to the website. I suppose, since you're using WAV files, there would potentially be some serious downloading time. But nevertheless, I thought it worth mentioning.
Good luck,
-SN

I recommend looking into the scripting language AutoIt. (It's quite stable despite its "Beta" status, and the support forum is quite helpful.)
AutoIt lets you run programs, read and write files, eject the cd tray and much more in an easy-to-use language. Best of all, the script can be compiled into a stand-alone executable approx 90 kilobytes big that works Windows 95/98/Me/NT/2000/XP and above.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |