中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-09-25 03:18
47,813 topics / 349,918 posts / today 1 new / 48,274 members
DOS批处理 & 脚本技术(批处理室) » [VBS] How to convert line breaks in text to &vbcr& characters
Printable Version  2,986 / 18
Floor16 kich Posted 2007-04-16 01:38
中级用户 Posts 168 Credits 397
Hehe, it's too advanced, I can't understand it very well. Then, what exactly should be done? Brother Xia!
Floor17 slore Posted 2007-04-16 02:26
铂金会员 Posts 2,478 Credits 5,212
Let's see. The original text has some Chinese and then code examples. Let's translate the relevant parts.

The text translates to:

Put your那段 as a string conditionally...

Up to 255 characters per line and then split with _ for lines. There seems to be a limit for splitting lines too.

You need to convert a paragraph of text into a string.

ScriptInfo = "[Script Info]" & vbcrlf & ";This subtitle is English on top, Chinese at the bottom. English may appear inside the video." _
& vbcrlf & "ScriptType: v4.00" & vbcrlf & "Collisions: Normal" & vbcrlf _
& "PlayResX: 384" & vbcrlf & "PlayResY: 288" & vbcrlf & "Timer: 100.0000"

msgbox ScriptInfo

Then define V4Styles, even the styles inside, like:

;Chinese style
Format: Name, Fontname, Fontsize, PrimaryColour, SecondaryColour, TertiaryColour, BackColour, Bold, Italic, BorderStyle, Outline, Shadow, Alignment, MarginL, MarginR, MarginV, AlphaLevel, Encoding
Style: Default,Arial,17,&Hffffff,&H00ffff,&H000000,&H000000,-1,0,1,2,0,2,20,20,21,0,1

It can also be defined separately in several parts...

When using it

ScriptInfo & V4Styles combined is okay... Replace "in each line of the string with " and add quotes before and after. Then replace carriage returns with the string " & vbCrLf & "

You can limit the string length yourself
Floor18 kich Posted 2007-04-16 03:53
中级用户 Posts 168 Credits 397
I want to make a script that specifically converts a large block of text into a very long string (which can be checked for length with len). According to what slore said upstairs, this is manually analyzing characters, but when facing a very long article (such as a long HTML), it's not practical to operate. Then how to solve it next???

Thank you!! Hehe, newbie, please give more guidance!!
Floor19 baomaboy Posted 2007-04-16 05:23
银牌会员 Posts 554 Credits 1,513
Originally posted by slore at 2007-4-15 05:12:
What does it have to do with single quotes? It seems that only "" is special in strings.


slore is right,
The original intention of converting single quotes was for my encryption process. If there is such a symbol in the VBS code after encrypting into one line, the rest will be commented out. Actually, it has nothing to do with the topic because the characters to be converted are not the program code to be executed, but actual strings.

[ Last edited by baomaboy on 2007-4-16 at 05:50 AM ]
Prev  1 2
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023