China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-04 05:27
中国DOS联盟论坛 » DOS批处理 & 脚本技术(批处理室) » [VBS] How to convert line breaks in text to &vbcr& characters View 2,630 Replies 18
Floor 16 Posted 2007-04-16 01:38 ·  中国 安徽 马鞍山 电信
中级用户
★★
Credits 397
Posts 168
Joined 2006-10-08 10:07
19-year member
UID 64934
Status Offline
Hehe, it's too advanced, I can't understand it very well. Then, what exactly should be done? Brother Xia!
Floor 17 Posted 2007-04-16 02:26 ·  中国 陕西 西安 电信
铂金会员
★★★★
Credits 5,212
Posts 2,478
Joined 2007-02-08 23:39
19-year member
UID 79003
Gender Male
Status Offline
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
Floor 18 Posted 2007-04-16 03:53 ·  中国 安徽 马鞍山 电信
中级用户
★★
Credits 397
Posts 168
Joined 2006-10-08 10:07
19-year member
UID 64934
Status Offline
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!!
Floor 19 Posted 2007-04-16 05:23 ·  中国 河北 保定 联通
银牌会员
★★★
Credits 1,513
Posts 554
Joined 2005-12-30 00:50
20-year member
UID 48180
Gender Male
Status Offline
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 ]
Forum Jump: