Not able to read nextline in paragraph using vbscript nextline commands (i.e vbnewline,vbclrf etc).
SOLVED- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not able to read nextline in paragraph using vbscript nextline commands (i.e vbnewline,vbclrf etc).
I am using vbscript language and I have converted pdf to text and all the texts are stored in a varieble . Now I Want each words to get stored in a array or list. For that I am spliting them and storing. But Splitting for nextline is not working. when I am using vbscript commands like vbnewline,vbclrf etc to read nextline in text its
not reading them. Its able to print two texts in next line, but If I want to read nextline character its not reading at all.
Solved! Go to Solution.
- Labels:
-
Script Tests
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Here's a small example,
Sub main()
myString = "TestComplete is a functional automated testing platform developed by SmartBear Software." & vbCrLf _
& "TestComplete gives testers the ability to create automated tests for Microsoft Windows, Web, Android, and iOS applications."
myWord = Split(myString, vbCrLf)
for each word in myWord
Log.Message(word)
next
End Sub
There's plenty of references on the internet, if you do a search
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You have inserted vbclrf in your string example.
After converting a pdf to text using pdftotext method. the data is getting stored and coming in nextline.
String = "TestComplete is a functional
automated testing platform
developed by SmartBear Software
TestComplete gives testers the ability to create automated
tests for Microsoft Windows, Web, Android, and iOS applications"
Now here This vbclrf or vbnewline is not working at all. Here how can I read nextline character.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The string you have provided is not valid for vbscript.
I suggest you look at https://gist.github.com/simply-coded/2410f59e198019e7d598221abc476c1b which formats the string into multiple lines.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
In this example,
I'm reading the clipboard text that I've copied from Notepad++. I'm showing all characters which include CR and LF.
I'm using the Split method to split each line; you can also perform another Split to split each word, and then insert vbCrLf.
It's important that the string is formatted correctly, to perform string manipulation
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I have a PDF which has a tabular data ,After doing c1= PDF.ConvertToText(path1) , when I am displaying my data then it is coming like this.(This is the Screenshot of data which has been read by Testcomplete)
Now I need each word to get stored in array in vbscript.
As per your above response then testcomplete is generating wrong format of data its a bug then.
Otherwise there has to be some solution.Having said that Testcomplete is not reading vbscript nextline characters like vbcrlf ,vbnewline etc , where as in javascript It is reading "\n" But I want in Vbscript.
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You need to check what character(s) is between Business Use and Name: APMP-00004707, as it could be either vbCr, vbCrLf or vbLf. I've never used PDF.ConvertToText() method, so I don't know what it uses for return line.
Once you have figured out the character, then you can store each line into an array
