While send xml to tally to fetch any information from tally into VB then response xml only showing that TallyPrime Server is Running. Response is same while xml has changed or pause / timed is inserted before EXRes receive response from tally.
Public Sub LdrEx()
Dim ExCd As String
ExCd = LedXmCd()
Dim objXML As MSXML2.ServerXMLHTTP
Set objXML = New MSXML2.ServerXMLHTTP
objXML.Open "POST", "http://localhost:9000", False
objXML.send ExCd
Dim EXRes As String
EXRes = objXML.responseXML
Set objXML = Nothing
Dim TFile As String
TFile = Environ("HOMEDRIVE") & Environ("HOMEPATH") & "\Desktop\LdReceived.xml"
Open TFile For Output As #1
Print #1, EXRes
Close #1
End Sub
XML from LedXmCd() is:
<ENVELOPE>
<HEADER>
<VERSION>1</VERSION>
<TALLYREQUEST>EXPORT</TALLYREQUEST>
<TYPE>DATA</TYPE>
<ID>Voucher Register</ID>
</HEADER>
<BODY>
<DESC>
<STATICVARIABLES>
<SVFROMDATE TYPE="Date">20210101</SVFROMDATE>
<SVTODATE TYPE="Date">20210101</SVTODATE>
<VOUCHERTYPENAME TYPE="STRING">Receipt</VOUCHERTYPENAME>
</STATICVARIABLES>
</DESC>
</BODY>
</ENVELOPE>
Check whether XML is saved in variable ExCd by adding watch and adding breakpoint at
objXML.send ExCd
Related
I am running through command prompt on Windows and I am getting the alert at 24th line and 34th char
Code sample are as follows:
Sub CatchMe()
Dim outobj, mailobj
Dim strFileText
Dim objFileToRead
Set outobj = CreateObject("Outlook.Application")
Set mailobj = outobj.CreateItem(0)
strFileText = GetText("C:\Users\Yatheesh.Sathyanaray.STDC\Documents1.txt")
With mailobj
.To = "yatheesh.satyanarayana#stratogent.com"
.Subject = "Testmail"
.Body = strFileText
.Display
End With
'Clear the memory
Set outobj = Nothing
Set mailobj = Nothing
End Sub
Function GetText(sFile As String) As String
Dim nSourceFile As Integer, sText As String
nSourceFile = FreeFile
'Write the entire file to sText
Open sFile For Input As #nSourceFile
sText = Input$(LOF(1), 1)
Close
GetText = sText
End Function
It works in my machine with your code provide. I've tested it in a Excel file and copy your code as below:
However, I'm noticed you used a property named "FreeFile", Use without what it seems that.
I am trying to run a VBScript that searches all the Incoming messages for a specific string on the subject field and replaces it with something else but keeping the rest of the subject content. So far, this is my code but im not getting any results.
Incoming mails subject: [EXTERNAL] abcdfed ghijk lmno
What i need: [*] abcdfed ghijk lmno
Sub RunAScriptRuleRoutine(MyMail As MailItem)
Dim strID As String
Dim olNS As Outlook.NameSpace
Dim msg As Outlook.MailItem
Dim rply As Outlook.MailItem
strID = MyMail.EntryID
Set olNS = Application.GetNamespace("MAPI")
Set msg = olNS.GetItemFromID(strID)
' do stuff with msg, e.g.
msg.Subject = Replace(msg.Subject, "[EXTERNAL]", "[*]")
msg.Save
Set msg = Nothing
Set olNS = Nothing
End Sub
I will appreciate your help
Changes to the subject for received messages will only be reflected in the header UI. You also have to change the MailItem.ConversationTopic value, but it is read-only. However, you can use PropertyAccessor.SetProperty("http://schemas.microsoft.com/mapi/proptag/0x0070001F", "New subject") to update it.
I have a LotusScript script library that formats an HTML mail document that it works fine unless the SendTo name contains an accented character.
-- Edit --
Sub Initialize
Dim s As New NotesSession
Dim mailName As String
Dim body As NotesMIMEEntity
Dim header As NotesMIMEHeader
Dim stream As NotesStream
Dim thisDB As NotesDatabase
Dim MailDoc As NotesDocument
Set thisDB = s.currentDatabase
Set mailDoc = thisDB.Createdocument()
mailName = "BØRG#WFSSystems.ca"
Set stream = s.CreateStream
s.ConvertMIME = False ' Do not convert MIME to rich text
Set body = mailDoc.CreateMIMEEntity
Set header = body.CreateHeader("To")
Call header.SetHeaderValAndParams("charset=UTF-16")
Call header.SetHeaderVal("MIME multipart message")
Call header.SetHeaderVal(mailName)
Call stream.writetext(|</body>|)
Call stream.writetext(|</html>|)
'Convert stream then send
Call body.SetContentFromText(stream, "text/HTML;charset=UTF-16", ENC_IDENTITY_7BIT)
Call mailDoc.Send(False)
s.ConvertMIME = True ' Restore conversion - very important
End Sub
Above is the whole sub that I set as a test. It looks like the accented character is maintained through the whole process and the email is actually sent. I'm working with a local copy of my mail file so I can see what ends up in mail.box. The Mail.box shows the recipient to be "BRG#WFSSystems.ca". So now I'm wondering if the issue is my code or is it my settings or preferences somewhere?
Hi guys i need litlle help. I have some web page with this line in his html:
<h3 class="entity-title"><a name="33333" class="link" href="/xy/xy-33333">some text</a></h3>
i want VBScript which open web page and find this line and copy "/xy/xy-33333" to some string variable. name,href and some text are always random
i have this part (saving all HTML to file.txt)
Dim oXMLHTTP
Dim oStream
Set oXMLHTTP = CreateObject("MSXML2.XMLHTTP.3.0")
oXMLHTTP.Open "GET", "http://www.yyy.com", False
oXMLHTTP.Send
If oXMLHTTP.Status = 200 Then
Set oStream = CreateObject("ADODB.Stream")
oStream.Open
oStream.Type = 1
oStream.Write oXMLHTTP.responseBody
oStream.SaveToFile "c:\te\file.txt"
oStream.Close
End If
Try something like this:
...
If oXMLHTTP.Status = 200 Then
Set html = CreateObject("HTMLfile")
html.write oXMLHTTP.responseText
For Each h3 In html.getElementsByTagName("h3")
If h3.getAttribute("class") = "entity-title" Then
For Each a In h3.getElementsByTagName("a")
WScript.Echo a.href
Next
End If
Next
End If
I have this vbscript that calls a web service written in .net 2010.
I'm getting an error at the last line. Can't figure it out.
This is the webservice:
http://www.kollelbaaleibatim.com/services/getinfo.asmx/GetFronpageInfo
Dim xmlDOC
Dim bOK
Dim J
Dim HTTP
Dim ImagePathLeftCar, ImagePathRightCar
Dim CarIDLeft, CarIDRight
Dim ShortTitleLeftCar, ShortTitleRightCar
Dim DescriptionLeftCar, DescriptionRightCar
Dim PriceLeftCar, PriceRightCar
Set HTTP = CreateObject("MSXML2.XMLHTTP")
Set xmlDOC =CreateObject("MSXML.DOMDocument")
xmlDOC.Async=False
HTTP.Open "GET","http://www.kollelbaaleibatim.com/services/getinfo.asmx/GetFronpageInfo", false
HTTP.setRequestHeader "Content-Type", "application/x-www-form-urlencoded"
HTTP.Send()
dim xmldoc2
set xmldoc2 = Server.CreateObject("Microsoft.XMLDOM")
xmldoc2.async = False
bOK = xmldoc2.load(HTTP.responseXML)
if Not bOK then
response.write( "Error loading XML from HTTP")
end if
response.write( xmldoc2.documentElement.xml)'Prints a good looking xml
ShortTitleLeftCar = xmldoc2.documentElement.selectSingleNode("LeftCarShortTitle").text 'ERROR HERE
This isn't a VBScript issue, it is an xpath issue. xmldoc2.documentElement.selectSingleNode("LeftCarShortTitle") will try find the "LeftCarShortTitle" element as a child of the root....which in your case won't work as there are various levels before this i.e. <string><Root><FrontpageData>.
Update your xpath to be:
//LeftCarShortTitle
This will traverse the descendants of the document and should find the node your looking for.