I need help. I'm trying to make a personal assistant with batch, and for effect, I want my computer to speak. I've used the speaking code before, even on this computer, but for some reason, when I try to use the speak command now, it doesn't seem to work. Here's the code I usually use:
Set objVoice=CreateObject("SAPI.SpVoice")
objVoice.Speak("Insert Message Here")
I don't know what happened, but when I run the script, I get this error:
Line: 2
Char: 1
Error: The handle is invalid.
Code 89970006
Source (null)
Please help me fix this error. Thanks in advance.
BY THE WAY, I do have Speech API, and my text to speech in Control Panel works. It seems to be the .vbs file.
Try This:
Set Speak = CreateObject("sapi.spvoice")
Speak.Speak "Text Goes Here"
Or, If you want to have it say something you enter you can do this,
Dim Message, Speak
Set Speak=CreateObject("sapi.spvoice")
Message=InputBox("Enter text","Speak")
Speak.Speak Message
Related
I am asking the first question on this site because I'm stuck in a problem.
Sorry for my bad English.
I'm creating a DataBase with some coding on VBA.
Some days ago I wrote some code which creates a folder on a ftp server. And it was working fine!
Today I picked up the database and testing this function and it creates a folder but with a different weird name every time.
I tried everything such as: change the windows encoding, reading the ftp server manual (there aren't changes from the last time!), testing it on a different database...but nothing happened.
I post the code maybe there is something I accidentally change.
thank you for your support!
Private Sub Tester_Logger_Click() ' TESTER
Dim hConnection, hOpen As Long
' Open Internet Connecion
hOpen = InternetOpen("FTP", 1, "", vbNullString, 0)
' Connect to FTP
hConnection = InternetConnect(hOpen, "IP", "21", "MYUsername", "MYPassword", INTERNET_SERVICE_FTP, INTERNET_FLAG_PASSIVE, 0)
FtpCreateDirectory hConnection, "\\TestFolder"
' Close Internet Connection
Call InternetCloseHandle(hOpen)
Call InternetCloseHandle(hConnection)
End Sub
EDIT:
I can create folders with FileZilla and from Windows Command Line.
I also used the command "status" (from the windows command line) to see the proprieties:
Type : ascii, Verbose: On, Bell: Off, Prompting: On, Globbing: On, Debug: Off, Hash: Off.
The weird name when i create a directory with the code above is: "xӺ �" If I run it the second time it creates a directory with this name: "(j��"
EDIT 2: I don't have a second computer, but i tried to change ftp host service and it happen again. I don't know if it's a problem of Office/Windows Upragrading. I'm sure that i did not touched anything. I tried to use a old backup version of the Database and nothing change... i have always this strange characters when i'm creating a new directory.
When I try to upload something it seems that it can't read the name of the folders. The Folders are created correctly with FileZilla and they are there, i Checked!
I read somewhere that maybe it's a problem of encoding. There is a note on FileZilla that says if there is no matching with encoding there will be problems with characters reading.
EDIT 3: I tried to reset to default settings VBA and Microsoft Access whit regedit and nothing happened.
I also tried to use different functions;
I used InternetconnectW,InternetOpenW, and FtpCreateDirectoryW instead of internetConnectA etc... because is written on the Microsoft guide those are functions for the Unicode encoding. But it's always the same.
Please someone can help me?
Thank you.
Sorry I really don't know how to describe my question.I'm new to study Gin:
When I run "go build xxxx" in Goland, like:
the console shows some unusual words:
I think the cause is that:Gin wants to show us some colorful words but the console couldn't parse them well so it show us the origin code of those color text.
How to make sure the console gives the parsed words?
This is a known bug, you can read more about it here as well as vote for the issue to get notified of progress. To work around the problem, please do the following.
Open Help | Find Action...
Type Registry and hit Enter.
Find go.run.processes.with.pty and disable it.
I'm trying to use Help Files to add contextual help in MsgBox (from Catia).
The idea is that the MsgBox is too small, and too limited (no pictures, no links...) to clearly display help.
So I'm calling MsgBox like this:
iType = iType + vbMsgBoxHelpButton
MsgBox(sMessage, iType, sType, sHelpF, CStr(iContext))
With this the "help" button is correctly added, and if i run this from Catia Debugger, I get the correct result, ie my help file is opening, at the page iContext. The help file I use is a CHM, generated with HelpNDoc.
But if I run this from a CATScript (what i need to do in the end), the button "help" is displayed, but when clicking on it, the Help file is not opened, and instead i got this error:
For many reasons, i can't use .catvba or .bas files (it's working for this, but i still can't for other reasons), I must work with CATScripts
Any suggestions?
I've been trying different settings on the CHM generation, but I always get the same result. And the MSDN documentation on the use of Help files is really scarce, so is the comments on this issue over the web.
Thanks in advance!
Instead of a MsgBox, you can generate a hta file with a link to what you need.
I am running macros in a mainframe emulator that read a text file to get the input key for a CICS screen and loop through the pages of the CICS screen outputting to Excel. Our emulator software has changed from Passport to Bluezone which has required some re-engineering of the proprietary screen logic but has also thrown up some weird errors with VB syntax. A number of them whilst annoying were easily resolved but my issue now is that I cannot seem to get the script to handle the end of file properly. Below is a snapshot of the logic that I have tried. When using the AtEndOfStream logic I get an "Input past end of file" error - when using the EOF logic the script just loops, continually processing the last record on file. It seems like neither version is recognising the end of the file, the file being used is a simple ASCII notepad that in this case contains a 6-character string, each line terminated with return. Note that the version 1 logic is exactly the same as it was in the old macro that ran perfectly fine in the Passport Emulator without throwing any errors, also the Bluezone emulator developer guide suggests using the version 2 logic.
Version 1:
ForReading = 1
Set objFSObject = CreateObject("Scripting.FileSystemObject")
Set strFileContents = objFSObject.OpenTextFile(strFile,ForReading)
Do while not strFileContents.AtEndOfStream
dline = strFileContents.readLine
Version 2:
Open strFile For Input As #1
Do While Not EOF(1)
Line Input #1, dline
Any help will be greatly appreciated as I have reviewed numerous threads on "Input past end of file" errors and not found a resolution and this is particularly annoying given that it works fine in the old emulator software.
I'm trying to change the input mode to a given window.
Searching i found the Edit_SetInputMode function, but when i run it, it always returns 0 ( fails) .
The MSDN documentation doesn't seem be to revealing... Any ideas anyone
Thank you
Dan
The correct terminology is probably focus: See SetFocus
Oh! I see where you are coming from. There is no such thing as Edit_SetInputMode - unless you are developing for embedded Windows that is.
Win32 "Desktop" applications get to use this set of Edit_xxx messages.