Try this script http://board.homeseer.com/showthread...ghlight=random
It speaks a random line from a text file. The script can easily be modifed and comes with examples.
Announcement
Collapse
No announcement yet.
Script speak from a file
Collapse
X
-
Guest repliedOk, i found what i need. It works now.
Here is the full script i'm using =>
Code:' ###### Write in a file ####### Sub SaveFileAppend(astrFile, astrPage) Dim aobjFile Dim afileFS Set aobjFile = CreateObject("Scripting.FileSystemObject") Set afileFS = aobjFile.OpenTextFile(astrFile, 8 ,True,-1) afileFS.WriteLine(astrPage) afileFS.Close Set afileFS = Nothing Set aobjFile = Nothing End Sub '********Open it, speak line by line, archive it, then delete******* Sub main Dim MyFile Dim MyValue Dim fso, file, Path, data Path = "C:\Program Files\HomeSeer HSPRO\Logs\callers.log" Set fso = CreateObject("Scripting.FileSystemObject") If fso.FileExists(Path) Then Set file = fso.OpenTextFile(Path, 1, True,-1) MyFile = "C:\Program Files\HomeSeer HSPRO\Logs\callers_archive.log" MyValue = "*********** Updated on " & Date & " at " & Time &" **************" SaveFileAppend MyFile, MyValue Do Until file.AtEndOfStream data = file.ReadLine MyFile = "C:\Program Files\HomeSeer HSPRO\Logs\callers_archive.log" MyValue = Data SaveFileAppend MyFile, MyValue hs.speak (data) Loop file.Close fso.Deletefile (Path) Else hs.speak ("Pas de message.") End If End sub
Last edited by charlysquare; April 22, 2010, 09:44 PM.
Leave a comment:
-
Guest repliedCool ! Thx
Once i've read a line, is it possible to delete this line from the file ?
Leave a comment:
-
You can use the file system object to read the file and speak line by line.
Here's a script that reads a file to get you started.
Code:sub main() Dim fso, file Path = "c:\temp\text.txt" Set fso = CreateObject("Scripting.FileSystemObject") Set file = fso.OpenTextFile(Path, ForReading, True) Do Until file.AtEndOfStream data = file.ReadLine hs.speak (data) Loop file.Close end sub
Leave a comment:
-
Script speak from a file
Hello,
Is there a way to let HS speak from a .txt ?
Here's what i want to do :
1/ In a script, I store actions messages in a separated txt file (for example action.txt). What i want then is to hs.speak that action.txt (multiple lines separated with a comma)
3/ Once all the lines of action.txt have been read, i want to flag them so that it cannot be read twice
I don't know if it's really clear for you, and sorry about my english ;=)
Thanks for your help anyway,
CharlyTags: None
Leave a comment: