http://translate.google.com/translate_tts?tl=zh&q={$text}&ie=utf-8
$base_url = 'http://translate.google.com/translate_tts?';
$qs = http_build_query(array(
'tl' => 'zh',
'ie' => 'UTF-8',
'q' => utf8_encode($transtext)
));
$contents = file_get_contents($base_url . $qs);
file_put_contents("test.mp3",$contents);
file_put_contents($filename,$content);
file -bi file_name
iconv for charset conversion
2013年8月11日 星期日
Google TTS API
2013年7月23日 星期二
enable RSAT component.
RSAT start /w pkgmgr /iu:RemoteServerAdministrationTools-Roles-AD-DS-SnapIns;RemoteServerAdministrationTools-Roles-AD-DS;RemoteServerAdministrationTools-Roles-AD;RemoteServerAdministrationTools-Roles;RemoteServerAdministrationTools join machine to specific OU NETDOM JOIN machine /Domain:domain [/OU:ou path] netdom.exe need to be copied to c:\windows\system32\ netdom.exe.mui need to be copied to C:\Windows\System32\en-US\
2013年7月15日 星期一
embed msg in CDO
sample
Const cdoSendUsingMethod ="http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort = 2
Const cdoSMTPServer ="http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort ="http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout ="http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate ="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic = 1
Const cdoSendUserName ="http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword ="http://schemas.microsoft.com/cdo/configuration/sendpassword"
Const CdoReferenceTypeName = 1
Dim objConfig ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields ' As ADODB.Fields
Dim HtmlBody
Set objConfig = CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
With Fields
.Item(cdoSMTPServer) = "smtp.gmail.com"
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSendUsingMethod ) = 2
.Update
End With
Set objMessage = CreateObject("CDO.Message")
Set objBP = objMessage.AddRelatedBodyPart("d:\pwd_chg.png", "pwd_chg.png", CdoReferenceTypeName)
objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = ""
Set objBP = objMessage.AddRelatedBodyPart("d:\pwd_chg_chg.png", "pwd_chg_chg.png", CdoReferenceTypeName)
objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = ""
Set objBP = objMessage.AddRelatedBodyPart("d:\pwd_chg_done.png", "pwd_chg_done.png", CdoReferenceTypeName)
objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = ""
objBP.Fields.Update
Set objMessage.Configuration = objConfig
'HtmlBody="
"
'HtmlBody=HtmlBody & "
"
'HtmlBody=HtmlBody & "Testing the mail"
HtmlBody=Read_Template
With objMessage
.To = "kido.idv.tw@gmail.com"
.From = "kido.idv.tw@gmail.com"
.Subject = "mail subject"
'.TextBody = "SMTP Relay Test Sent @ " & Now()
.HtmlBody=HtmlBody
.Send
End With
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
Function Read_Template()
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, MyFile, FileName, TextLine
Set fso = CreateObject("Scripting.FileSystemObject")
FileName = "d:\pwd_notify.template"
Set MyFile = fso.OpenTextFile(FileName, ForReading, True)
Do While MyFile.AtEndOfStream <> True
TextLine = TextLine & MyFile.ReadLine
Loop
MyFile.Close
Read_Template=TextLine
End Function
=========================================================================================================================
Set objBP = objMessage.AddRelatedBodyPart("C:\Users\kido\Pictures\Google Talk\Leaf.bmp", "1.bmp", CdoReferenceTypeName)
objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = "<1 .bmp="">"1>
'objBP.Fields.Update
Set objBP = objMessage.AddRelatedBodyPart("C:\Users\kido\Pictures\Google Talk\Monkey 1.bmp", "monkey.bmp", CdoReferenceTypeName)
objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = ""
objBP.Fields.Update
HtmlBody="
"
setup image file name mapping first and then use the alias file name in mail content
Const cdoSendUsingMethod ="http://schemas.microsoft.com/cdo/configuration/sendusing"
Const cdoSendUsingPort = 2
Const cdoSMTPServer ="http://schemas.microsoft.com/cdo/configuration/smtpserver"
Const cdoSMTPServerPort ="http://schemas.microsoft.com/cdo/configuration/smtpserverport"
Const cdoSMTPConnectionTimeout ="http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout"
Const cdoSMTPAuthenticate ="http://schemas.microsoft.com/cdo/configuration/smtpauthenticate"
Const cdoBasic = 1
Const cdoSendUserName ="http://schemas.microsoft.com/cdo/configuration/sendusername"
Const cdoSendPassword ="http://schemas.microsoft.com/cdo/configuration/sendpassword"
Const CdoReferenceTypeName = 1
Dim objConfig ' As CDO.Configuration
Dim objMessage ' As CDO.Message
Dim Fields ' As ADODB.Fields
Dim HtmlBody
Set objConfig = CreateObject("CDO.Configuration")
Set Fields = objConfig.Fields
With Fields
.Item(cdoSMTPServer) = "smtp.gmail.com"
.Item(cdoSMTPConnectionTimeout) = 10
.Item(cdoSendUsingMethod ) = 2
.Update
End With
Set objMessage = CreateObject("CDO.Message")
Set objBP = objMessage.AddRelatedBodyPart("d:\pwd_chg.png", "pwd_chg.png", CdoReferenceTypeName)
objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = "
Set objBP = objMessage.AddRelatedBodyPart("d:\pwd_chg_chg.png", "pwd_chg_chg.png", CdoReferenceTypeName)
objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = "
Set objBP = objMessage.AddRelatedBodyPart("d:\pwd_chg_done.png", "pwd_chg_done.png", CdoReferenceTypeName)
objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = "
objBP.Fields.Update
Set objMessage.Configuration = objConfig
'HtmlBody="

"
'HtmlBody=HtmlBody & "

"
'HtmlBody=HtmlBody & "Testing the mail"
HtmlBody=Read_Template
With objMessage
.To = "kido.idv.tw@gmail.com"
.From = "kido.idv.tw@gmail.com"
.Subject = "mail subject"
'.TextBody = "SMTP Relay Test Sent @ " & Now()
.HtmlBody=HtmlBody
.Send
End With
Set Fields = Nothing
Set objMessage = Nothing
Set objConfig = Nothing
Function Read_Template()
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Dim fso, MyFile, FileName, TextLine
Set fso = CreateObject("Scripting.FileSystemObject")
FileName = "d:\pwd_notify.template"
Set MyFile = fso.OpenTextFile(FileName, ForReading, True)
Do While MyFile.AtEndOfStream <> True
TextLine = TextLine & MyFile.ReadLine
Loop
MyFile.Close
Read_Template=TextLine
End Function
=========================================================================================================================
Set objBP = objMessage.AddRelatedBodyPart("C:\Users\kido\Pictures\Google Talk\Leaf.bmp", "1.bmp", CdoReferenceTypeName)
objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = "<1 .bmp="">"1>
'objBP.Fields.Update
Set objBP = objMessage.AddRelatedBodyPart("C:\Users\kido\Pictures\Google Talk\Monkey 1.bmp", "monkey.bmp", CdoReferenceTypeName)
objBP.Fields.Item("urn:schemas:mailheader:Content-ID") = "
objBP.Fields.Update
HtmlBody="

"
setup image file name mapping first and then use the alias file name in mail content
2013年6月27日 星期四
wmi event monitoring
"select * from __InstanceOperationEvent within 1 where TargetInstance ISA 'Win32_PnPEntity' and TargetInstance.Description='USB Mass Storage Device'"
__InstanceOperationEvent
-->__InstanceCreationEvent
-->__InstanceDeletionEvent
-->__InstanceModificationEvent
__InstanceOperationEvent
-->__InstanceCreationEvent
-->__InstanceDeletionEvent
-->__InstanceModificationEvent
2013年6月19日 星期三
ADSI query string
Set conn = CreateObject("ADODB.Connection")
conn.Provider = "ADSDSOObject"
conn.Open "ADs Provider"
DomainFQDN= kido.idv.tw
DomainContainer="DC=kido,DC=idv,DC=tw"
query_str="(&(objectCategory=person)(objectClass=user)(&(sAMAccountName=*)(!(userAccountControl:1.2.840.113556.1.4.803:=2))))"
ldapStr = ";" & query_str & ";adspath;subtree"
Set rs = conn.Execute(ldapStr)
Set objConn = CreateObject("ADODB.Connection")
Set objRs = CreateObject("ADODB.Recordset")
objConn.Provider = "ADsDSOObject"
strConn = "Active Directory Provider"
objConn.Open strConn
strSql = "select mail from '" & DomainFQDN & "' where sAMAccountName='" & "kido" & "'"
objRs.Open strSql, objConn, 1, 1
conn.Provider = "ADSDSOObject"
conn.Open "ADs Provider"
DomainFQDN= kido.idv.tw
DomainContainer="DC=kido,DC=idv,DC=tw"
query_str="(&(objectCategory=person)(objectClass=user)(&(sAMAccountName=*)(!(userAccountControl:1.2.840.113556.1.4.803:=2))))"
ldapStr = "
Set rs = conn.Execute(ldapStr)
Set objConn = CreateObject("ADODB.Connection")
Set objRs = CreateObject("ADODB.Recordset")
objConn.Provider = "ADsDSOObject"
strConn = "Active Directory Provider"
objConn.Open strConn
strSql = "select mail from '" & DomainFQDN & "' where sAMAccountName='" & "kido" & "'"
objRs.Open strSql, objConn, 1, 1
2013年6月17日 星期一
2013年6月12日 星期三
list trusted domain info
Dim objConnection, objRootDSE, objRecordSet
Dim strFilter
strFilter = "(NETBIOSName=*)"
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objRootDSE = GetObject("LDAP://RootDSE")
Wscript.Echo objRootDSE.Get("configurationNamingContext")
Set objRecordSet = objConnection.Execute( _
";" & _
strFilter & ";" & "NETBIOSName,dnsroot,ncname;subtree")
Set objRootDSE = Nothing
While Not objRecordSet.EOF
WScript.Echo "NETBIOSName:" & objRecordSet.Fields("netbiosname").Value & vbTab _
& "DNSRoot:" & join(objRecordSet.Fields("dnsroot").Value) & vbTab _
& "CName:" & objRecordSet.Fields("ncname").Value
objRecordSet.MoveNext
WEnd
Dim strFilter
strFilter = "(NETBIOSName=*)"
Set objConnection = CreateObject("ADODB.Connection")
objConnection.Provider = "ADsDSOObject"
objConnection.Open "Active Directory Provider"
Set objRootDSE = GetObject("LDAP://RootDSE")
Wscript.Echo objRootDSE.Get("configurationNamingContext")
Set objRecordSet = objConnection.Execute( _
"
strFilter & ";" & "NETBIOSName,dnsroot,ncname;subtree")
Set objRootDSE = Nothing
While Not objRecordSet.EOF
WScript.Echo "NETBIOSName:" & objRecordSet.Fields("netbiosname").Value & vbTab _
& "DNSRoot:" & join(objRecordSet.Fields("dnsroot").Value) & vbTab _
& "CName:" & objRecordSet.Fields("ncname").Value
objRecordSet.MoveNext
WEnd
訂閱:
文章 (Atom)