Vbscript msgbox中的重音法语字符
我正在尝试编写一个vbscript,它使用Google speech来处理消息的发音 我必须将代码保存到记事本++中,使用UTF8编码,无BOM,发音良好,但消息框的显示不适合重音字符。 如何解决这个问题 谢谢大家!Vbscript msgbox中的重音法语字符,vbscript,Vbscript,我正在尝试编写一个vbscript,它使用Google speech来处理消息的发音 我必须将代码保存到记事本++中,使用UTF8编码,无BOM,发音良好,但消息框的显示不适合重音字符。 如何解决这个问题 谢谢大家! Option Explicit Call Ip_Publique() '*********************************************************************************************************
Option Explicit
Call Ip_Publique()
'***********************************************************************************************************************************************************
Sub Ip_Publique()
Dim Titre,URL,ie,objFSO,Data,OutPut,objRegex,Match,Matches,ip_public
Dim Message,URLFR
Message = "Vous êtes connecté à internet !" & VbCrlf & "Votre IP Publique est : "
URLFR = "http://translate.google.com/translate_tts?ie=UTF-8&tl=fr&q=" & Message
Titre = "Adresse Ip Publique !"
URL = "http://monip.org"
If OnLine("smtp.gmail.com") = True Then
Set ie = CreateObject("InternetExplorer.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
ie.Navigate (URL)
ie.Visible=False
DO WHILE ie.busy
Wscript.Sleep 100
Loop
Data = ie.document.documentElement.innertext
Set objRegex = new RegExp
objRegex.Pattern = "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"
objRegex.Global = False
objRegex.IgnoreCase = True
Set Matches = objRegex.Execute(Data)
For Each Match in Matches
Call Kill("wmplayer.exe")
Call WmPlaySound(URLFR & Match.Value)
MsgBox Message & Match.Value,64,Titre
Pause(10)
Call Kill("wmplayer.exe")
Next
ie.Quit
Set ie = Nothing
Else
MsgBox "Vérifier votre connexion internet puis re-executer ce script",48,Titre
Exit Sub
End If
End Sub
'************************************************************************************************************************************************************
Function OnLine(strHost)
Dim objPing,z,objRetStatus,PingStatus
Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address = '" & strHost & "'")
z = 0
Do
z = z + 1
For Each objRetStatus In objPing
If IsNull(objRetStatus.StatusCode) Or objRetStatus.StatusCode <> 0 Then
PingStatus = False
Else
PingStatus = True
End If
Next
Call Pause(1)
If z = 4 Then Exit Do
Loop until PingStatus = True
If PingStatus = True Then
OnLine = True
Else
OnLine = False
End If
End Function
'*********************************************************************************************
'Fonction pour ajouter les doubles quotes dans une variable
Function DblQuote(Str)
DblQuote = Chr(34) & Str & Chr(34)
End Function
'**********************************************************************************************
Sub WmPlaySound(MySound)
Dim WshShell
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "wmplayer "& DblQuote(MySound) &"",0,False
Set WshShell = Nothing
End Sub
'**********************************************************************************************
Sub Kill(Process)
Dim Ws,Command,Execution
Set Ws = CreateObject("WScript.Shell")
Command = "cmd /c Taskkill /F /IM "&Process&""
Execution = Ws.Run(Command,0,True)
End Sub
'**********************************************************************************************
Sub Pause(NSeconds)
Wscript.Sleep(NSeconds*1000)
End Sub
'**********************************************************************************************
选项显式
呼叫Ip_Publique()
'***********************************************************************************************************************************************************
副Ip_Publique()
尺寸标题、URL、ie、objFSO、数据、输出、objRegex、匹配、匹配、ip_公共
暗淡消息
Message=“您可以连接互联网!”&VbCrlf和“Votre IP Publique est:”
URLFR=”http://translate.google.com/translate_tts?ie=UTF-8&tl=fr&q=“&消息
Titre=“地址:Ip Publique!”
URL=”http://monip.org"
如果在线(“smtp.gmail.com”)=True,则
设置ie=CreateObject(“InternetExplorer.Application”)
设置objFSO=CreateObject(“Scripting.FileSystemObject”)
ie.导航(URL)
可见=假
忙着干吧
Wscript.Sleep 100
环
数据=ie.document.documentElement.innertext
Set objRegex=new RegExp
模式=“\b([0-9]{1,3}\){3}[0-9]{1,3}\b”
objRegex.Global=False
objRegex.IgnoreCase=True
Set Matches=objRegex.Execute(数据)
比赛中的每一场比赛
调用Kill(“wmplayer.exe”)
调用WmPlaySound(URLFR&Match.Value)
MsgBox消息和匹配值,64,标题
暂停(10)
调用Kill(“wmplayer.exe”)
下一个
即退出
设置ie=无
其他的
MsgBox“Vérifier votre connexion internet puis re executer ce script”,48,标题
出口接头
如果结束
端接头
'************************************************************************************************************************************************************
在线功能(strHost)
尺寸对象,z,对象状态,PingStatus
Set objPing=GetObject(“winmgmts:{impersonationLevel=impersonate}”).ExecQuery(“从Win32中选择*,其中地址=””&strHost&“”)
z=0
做
z=z+1
对于objRetStatus中的每个objRetStatus
如果IsNull(objRetStatus.StatusCode)或objRetStatus.StatusCode为0,则
PingStatus=False
其他的
PingStatus=True
如果结束
下一个
呼叫暂停(1)
如果z=4,则退出Do
循环直到PingStatus=True
如果PingStatus=True,则
在线=真
其他的
在线=错误
如果结束
端函数
'*********************************************************************************************
'Fonction pour ajour les double引用了一个变量
函数DblQuote(Str)
DblQuote=Chr(34)和Str&Chr(34)
端函数
'**********************************************************************************************
子WmPlaySound(MySound)
昏暗的地狱
设置WshShell=CreateObject(“WScript.Shell”)
WshShell.Run“wmplayer”&DblQuote(MySound)和“”,0,False
设置WshShell=Nothing
端接头
'**********************************************************************************************
分段压井(工艺)
Dim Ws、命令、执行
设置Ws=CreateObject(“WScript.Shell”)
Command=“cmd/c Taskkill/F/IM”&Process&“
Execution=Ws.Run(命令,0,True)
端接头
'**********************************************************************************************
子暂停(N秒)
Wscript.Sleep(秒*1000)
端接头
'**********************************************************************************************
好的,我就这样解决了,你可以试试,然后把你的反馈给我
脚本保存为ANSI,对我来说效果很好
说明:
此脚本将显示三种不同语言的消息框用谷歌语音讲话
选项显式
呼叫Ip_Publique()
'***********************************************************************************************************************************************************
副Ip_Publique()
尺寸标题、URL、ie、objFSO、数据、输出、objRegex、匹配、匹配、ip_公共、ip
Dim MessageEN,MessageFR,MessageAR,URLEN,URLFR,URLAR,版权所有
版权所有=“(2014©Hackoo)”
MessageEN=“您已连接到internet!”&VbCrlf&“您的公共IP地址为”
MessageFR=“您可以连接互联网!”&VbCrlf和“Votre IP Publique est”
MessageAR=ChrW(1571)&ChrW(1606)&ChrW(1578)&ChrW(32)&ChrW(1605)&ChrW(1578)&ChrW(1589)&ChrW(1604)&_
ChrW(32)&ChrW(1576)&ChrW(1588)&ChrW(1576)&ChrW(1603)&ChrW(1577)&ChrW(32)&ChrW(1575)&ChrW(1604)&ChrW(1573)&_
ChrW(1606)&ChrW(1578)&ChrW(1585)&ChrW(1606)&ChrW(1578)&VbCrlf&IP
乌伦=”http://translate.google.com/translate_tts?tl=en&q=“&MessageEN”
URLFR=”http://translate.google.com/translate_tts?tl=fr&q=“&MessageFR”
URLAR=”http://translate.google.com/translate_tts?ie=UTF-8&tl=ar&q=“&MessageAR”
Titre=“Adresse IP Publique”&版权所有
URL=”http://monip.org"
如果在线(“smtp.gmail.com”)=True,则
设置ie=CreateObject(“InternetExplorer.Application”)
设置objFSO=CreateObject(“Scripting.FileSystemObject”)
ie.导航(URL)
可见=假
忙着干吧
Wscript.Sleep 100
环
数据=ie.document.documentElement.innertext
Set objRegex=new RegExp
模式=“\b([0-9]{1,3}\){3}[0-9]{1,3}\b”
objRegex.Global=False
objRegex.IgnoreCase=True
Set Matches=objRegex.Execute(数据)
比赛中的每一场比赛
IP=匹配。值
调用NavigateIE(URLE)
Option Explicit
Call Ip_Publique()
'***********************************************************************************************************************************************************
Sub Ip_Publique()
Dim Titre,URL,ie,objFSO,Data,OutPut,objRegex,Match,Matches,ip_public,IP
Dim MessageEN,MessageFR,MessageAR,URLEN,URLFR,URLAR,Copyright
Copyright = "(2014 © Hackoo)"
MessageEN = "You are connected to the internet !" & VbCrlf & "Your Public IP Adress is "
MessageFR = "Vous êtes connecté à internet !" & VbCrlf & "Votre IP Publique est "
MessageAR = ChrW(1571)&ChrW(1606)&ChrW(1578)&ChrW(32)&ChrW(1605)&ChrW(1578)&ChrW(1589)&ChrW(1604)&_
ChrW(32)&ChrW(1576)&ChrW(1588)&ChrW(1576)&ChrW(1603)&ChrW(1577)&ChrW(32)&ChrW(1575)&ChrW(1604)&ChrW(1573)&_
ChrW(1606)&ChrW(1578)&ChrW(1585)&ChrW(1606)&ChrW(1578)& VbCrlf & "IP "
URLEN = "http://translate.google.com/translate_tts?tl=en&q=" & MessageEN
URLFR = "http://translate.google.com/translate_tts?tl=fr&q=" & MessageFR
URLAR = "http://translate.google.com/translate_tts?ie=UTF-8&tl=ar&q=" & MessageAR
Titre = "Adresse IP Publique " & Copyright
URL = "http://monip.org"
If OnLine("smtp.gmail.com") = True Then
Set ie = CreateObject("InternetExplorer.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
ie.Navigate (URL)
ie.Visible=False
DO WHILE ie.busy
Wscript.Sleep 100
Loop
Data = ie.document.documentElement.innertext
Set objRegex = new RegExp
objRegex.Pattern = "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"
objRegex.Global = False
objRegex.IgnoreCase = True
Set Matches = objRegex.Execute(Data)
For Each Match in Matches
IP = Match.Value
Call NavigateIE(URLEN & IP)
MsgBox MessageEN & IP,64,Titre
Call NavigateIE(URLFR & IP)
MsgBox MessageFR & IP,64,Titre
Call NavigateIE(URLAR & IP)
MsgBox MessageAR & IP,64,Titre
Next
ie.Quit
Set ie = Nothing
Else
MsgBox "Vérifier votre connexion internet puis re-executer ce script",48,Titre
Exit Sub
End If
End Sub
'************************************************************************************************************************************************************
Function OnLine(strHost)
Dim objPing,z,objRetStatus,PingStatus
Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}").ExecQuery("select * from Win32_PingStatus where address = '" & strHost & "'")
z = 0
Do
z = z + 1
For Each objRetStatus In objPing
If IsNull(objRetStatus.StatusCode) Or objRetStatus.StatusCode <> 0 Then
PingStatus = False
Else
PingStatus = True
End If
Next
Call Pause(1)
If z = 4 Then Exit Do
Loop until PingStatus = True
If PingStatus = True Then
OnLine = True
Else
OnLine = False
End If
End Function
'*********************************************************************************************
'Fonction pour ajouter les doubles quotes dans une variable
Function DblQuote(Str)
DblQuote = Chr(34) & Str & Chr(34)
End Function
'**********************************************************************************************
Sub Pause(NSeconds)
Wscript.Sleep(NSeconds*1000)
End Sub
'**********************************************************************************************
Sub NavigateIE(URL)
Dim objExplorer
Set objExplorer = CreateObject("InternetExplorer.Application")
with objExplorer
.Navigate(URL)
.Visible = False
end with
End Sub
'**********************************************************************************************