|
kich
中级用户
  
积分 397
发帖 168
注册 2006-10-8
状态 离线
|
『楼 主』:
[VBS]如何把文本中回车转换成&vbcr&字符
使用 LLM 解释/回答一下
如何把文本中回车转换成&vbcr&字符??
比如用ReadAll读了个文本的内容,假设是:
ff
fukkk
eee
然后把转换成:
ff&vbcr&fukkk&vbcr&eee
我用Asc函数转换,但转换成这样的:
ff
&vbcr&fukkk
&vbcr&eee
请指教啊!谢谢
How to convert carriage returns in text into &vbcr& characters??
For example, if you read the content of a text using ReadAll, and suppose it is:
ff
fukkk
eee
Then convert it to:
ff&vbcr&fukkk&vbcr&eee
I used the Asc function for conversion, but it converted to this:
ff
&vbcr&fukkk
&vbcr&eee
Please give me some advice! Thank you
|
|
2007-4-14 10:02 |
|
|
baomaboy
银牌会员
    
积分 1513
发帖 554
注册 2005-12-30
状态 离线
|
『第 2 楼』:
使用 LLM 解释/回答一下
Originally posted by kich at 2007-4-14 10:02:
如何把文本中回车转换成&vbcr&字符??
比如用ReadAll读了个文本的内容,假设是:
ff
fukkk
eee
然后把转换成:
ff&vbcr&fukkk&vbcr&eee
我 ...
你所谓的回车,其实是回车+换行,如果没猜错的话,你只是替换了回车,还剩换行在呢,当然是那效果。
Originally posted by kich at 2007-4-14 10:02:
How to convert the carriage returns in the text into &vbcr& characters??
For example, if you read the content of a text with ReadAll, assuming it is:
ff
fukkk
eee
Then convert it to:
ff&vbcr&fukkk&vbcr&eee
I ...
What you call a carriage return is actually carriage return + line feed. If I'm not mistaken, you only replaced the carriage return, and the line feed is still there, which is why it has that effect.
|

好多菩提树,好多明镜台。本来好多物,好多的尘埃。 |
|
2007-4-14 11:40 |
|
|
kich
中级用户
  
积分 397
发帖 168
注册 2006-10-8
状态 离线
|
『第 3 楼』:
使用 LLM 解释/回答一下
哦,对的,恩,谢谢了!好象是这么做的!!
问一下,把一篇TXT文字(里面可能会有特殊符号和回车)定义成一个很长的字符,然后放到VBS脚本里做为一个常数,怎么做啊??
Oh, right, uh, thanks! It seems like this is how to do it!!
Asking, how to define a long character from a TXT text (which may have special symbols and line breaks) as a constant in a VBS script?
|
|
2007-4-14 11:57 |
|
|
baomaboy
银牌会员
    
积分 1513
发帖 554
注册 2005-12-30
状态 离线
|
『第 4 楼』:
使用 LLM 解释/回答一下
Originally posted by kich at 2007-4-14 11:57:
哦,对的,恩,谢谢了!好象是这么做的!!
问一下,把一篇TXT文字(里面可能会有特殊符号和回车)定义成一个很长的字符,然后放到VBS脚本里做为一个常数,怎么做啊??
没看明白你的意思.
Originally posted by kich at 2007-4-14 11:57:
Oh, right, uh, thank you! It seems to be done like this!!
Ask, how to define a long character from a TXT text (which may contain special symbols and line breaks) as a constant in a VBS script?
Didn't understand what you mean.
|

好多菩提树,好多明镜台。本来好多物,好多的尘埃。 |
|
2007-4-14 12:13 |
|
|
kich
中级用户
  
积分 397
发帖 168
注册 2006-10-8
状态 离线
|
『第 5 楼』:
使用 LLM 解释/回答一下
就是说,如果我有一大段文字,我需要它作为一个常量,然后我准备输入到其他文本里(因为其他文本要用到这些文字).比如说,一个HTML的小段文字,我要把它作为一个常量输出,但它里面有特殊字符,怎么解决??(回车和引号,不能把这一大段作为一个常量吧,因为有回车在里面嘛)
不知道有没有说明白!!
That is to say, if I have a long passage of text, I need it as a constant, and then I am going to input it into other texts (because other texts need to use these words). For example, a small piece of HTML text, I want to output it as a constant, but there are special characters in it, how to solve it?? (Line breaks and quotes, I can't treat this long passage as a constant, because there are line breaks in it)
I don't know if it's clear enough!!
|
|
2007-4-15 00:13 |
|
|
baomaboy
银牌会员
    
积分 1513
发帖 554
注册 2005-12-30
状态 离线
|
『第 6 楼』:
使用 LLM 解释/回答一下
引号 可以用chr(34)
不如你再说明白一些你的最终目的,比如这样做是为了"加密" 或其他的
Quotation marks can be represented by chr(34).
Why don't you explain your final goal more clearly, for example, is this done for "encryption" or something else?
|

好多菩提树,好多明镜台。本来好多物,好多的尘埃。 |
|
2007-4-15 00:20 |
|
|
kich
中级用户
  
积分 397
发帖 168
注册 2006-10-8
状态 离线
|
『第 7 楼』:
使用 LLM 解释/回答一下
我的目的:
我是想做一个中英文双字幕的字幕文件,但首先要对这些字幕做格式说明,因为我要对很多电影的字幕做操作,而他们的格式都是一样的,所以,这些定义的格式,可以把它做成一个常量放在VBS文件里,然后,分别调入中英文字幕再稍加处理,然后在这些中英文字幕的最前面加上定义的格式说明(就是那个常量),但这个常量是个比较长的文本段,有十几行,没办法做成一个常量.
为更表达更清晰,把那个格式定义帖出来放在下面,看看怎么把这段文本做成一个常量呢?
;本字幕为英语在上,汉语在下,视频内部有时会出现英语.
ScriptType: v4.00
Collisions: Normal
PlayResX: 384
PlayResY: 288
Timer: 100.0000
;汉字样式
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
;英语样式
Style: Default2,Arial,12,&Hffffff,&H00ffff,&H000000,&H000000,-1,0,1,2,0,2,20,20,5,0,1
;当视频内置英文字幕时,则用次汉语字幕样式,以至不会隐藏掉视频里的英语字幕.
Style: Default3,Arial,15,&Hffffff,&H00ffff,&H000000,&H000000,-1,0,1,2,0,2,20,20,5,0,1
当然,有时候还涉及到引号!
Thx
Last edited by kich on 2007-4-15 at 12:27 AM ]
My Purpose:
I want to make a subtitle file with both Chinese and English subtitles. But first, I need to explain the format of these subtitles. Because I need to operate on subtitles of many movies, and their formats are all the same. So, these defined formats can be made into a constant in a VBS file, and then the Chinese and English subtitles are respectively called in and slightly processed, and then the defined format description (that constant) is added at the front of these Chinese and English subtitles. But this constant is a relatively long text segment, with more than a dozen lines, and it's impossible to make it into a constant.
To express more clearly, post that format definition below and see how to make this text into a constant?
; This subtitle is with English on top and Chinese at the bottom. Sometimes English may appear inside the video.
ScriptType: v4.00
Collisions: Normal
PlayResX: 384
PlayResY: 288
Timer: 100.0000
; Chinese character 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
; English style
Style: Default2,Arial,12,&Hffffff,&H00ffff,&H000000,&H000000,-1,0,1,2,0,2,20,20,5,0,1
; When there are built-in English subtitles in the video, then use the secondary Chinese subtitle style so as not to hide the English subtitles in the video.
Style: Default3,Arial,15,&Hffffff,&H00ffff,&H000000,&H000000,-1,0,1,2,0,2,20,20,5,0,1
Of course, sometimes quotes are also involved!
Thx
Last edited by kich on 2007-4-15 at 12:27 AM ]
|
|
2007-4-15 00:26 |
|
|
kich
中级用户
  
积分 397
发帖 168
注册 2006-10-8
状态 离线
|
『第 8 楼』:
使用 LLM 解释/回答一下
我以前的做法是把这段文字作成一个文本文件放在那,然后用ReadAll调用,但这就要求这个文本文件必须存在,很麻烦,一个脚本+一个文件!
如果把这段文字定义成常量放在VBS里,这样就省事多了,可以随便拷贝了!!
My previous approach was to create this text as a text file and place it there, then use ReadAll to call it, but this requires that the text file must exist, which is cumbersome, a script plus a file!
If I define this text as a constant in VBS, it will be much more convenient, and I can copy it freely!!
|
|
2007-4-15 00:31 |
|
|
baomaboy
银牌会员
    
积分 1513
发帖 554
注册 2005-12-30
状态 离线
|
『第 9 楼』:
使用 LLM 解释/回答一下
Originally posted by kich at 2007-4-15 00:31:
我以前的做法是把这段文字作成一个文本文件放在那,然后用ReadAll调用,但这就要求这个文本文件必须存在,很麻烦,一个脚本+一个文件!
如果把这段文字定义成常量放在VBS里,这样就省事多了,可以随便拷贝了!!
遇到阻碍单行的符号就用替换的方法吧,要输出时再还原,呵呵 几乎所有的病毒都是用此法加密自身为单行的,替换成一些绝对不会有冲突的比如chr(18)、chr(30)。。。
Last edited by baomaboy on 2007-4-15 at 01:05 AM ]
Originally posted by kich at 2007-4-15 00:31:
The way I used to do it was to make this text into a text file and place it there, then use ReadAll to call it, but this requires that this text file must exist, which is very troublesome, one script + one file!
If you define this text as a constant in VBS, it will be much more convenient, and you can copy it freely!!
When encountering symbols that block a single line, use the replacement method. Restore it when outputting. Hehe. Almost all viruses use this method to encrypt themselves into a single line, replacing them with some absolutely no conflicts such as chr(18), chr(30)...
Last edited by baomaboy on 2007-4-15 at 01:05 AM ]
|

好多菩提树,好多明镜台。本来好多物,好多的尘埃。 |
|
2007-4-15 00:55 |
|
|
kich
中级用户
  
积分 397
发帖 168
注册 2006-10-8
状态 离线
|
『第 10 楼』:
使用 LLM 解释/回答一下
哦,原来就是用一个不会冲突的字符代替啊,那就用一些特殊字符来替换吗?
那回车+换行怎么换!
我是想做一个专门用于转换的VBS文件,把文件拖上去,然后就输出一个替换过的文件!
那么这个VBS在处理回车+换行,应该怎么写程序呢?
Replace(content,chr(13)+char(10),cha(18))??
Oh, so it's just replacing with a non-conflicting character? Then use some special characters to replace?
Then how to replace carriage return + line feed!
I want to make a specially used VBS file, drag the file onto it, and then output a replaced file!
Then how to write the program for this VBS to handle carriage return + line feed?
Replace(content,chr(13)+char(10),cha(18))??
|
|
2007-4-15 01:07 |
|
|
baomaboy
银牌会员
    
积分 1513
发帖 554
注册 2005-12-30
状态 离线
|
『第 11 楼』:
使用 LLM 解释/回答一下
Originally posted by kich at 2007-4-15 01:07:
哦,原来就是用一个不会冲突的字符代替啊,那就用一些特殊字符来替换吗?
那回车+换行怎么换!
我是想做一个专门用于转换的VBS文件,把文件拖上去,然 ...
Replace(content,chr(13)+char(10),cha(18))??
分别替换因为个别时回车和换行不连接,那Replace(content,chr(13)+char(10),cha(18))失效了。
Replace(content,chr(13),cha(28))
Replace(content,chr(13),cha(29))
Replace(content,chr(34),cha(18)) 替换" 因为 " 在VBS中用于注释 变单行后 " 之后全变成注释了 所以必须换掉。
想拖到上面输出:
content=readallstr
content=Replace(content,chr(13),cha(28))
content=Replace(content,chr(13),cha(29))
content=Replace(content,chr(34),cha(18))
fso.输出content
原理是这样的 实际操作中大多用 For len(content) 遍历来替换的
Last edited by baomaboy on 2007-4-15 at 01:39 AM ]
Originally posted by kich at 2007-4-15 01:07:
Oh, it turns out that it's just replacing with a non-conflicting character. Then, do we use some special characters to replace?
Then how to replace the carriage return + line feed!
I want to make a dedicated VBS file for conversion. Drag the file onto it, and then...
Replace(content,chr(13)+char(10),cha(18))??
Because sometimes the carriage return and line feed are not connected individually, then Replace(content,chr(13)+char(10),cha(18)) fails.
Replace(content,chr(13),cha(28))
Replace(content,chr(13),cha(29))
Replace(content,chr(34),cha(18)) Replace " because " is used for comments in VBS. After becoming a single line, all after " becomes a comment, so it must be replaced.
Want to drag and output on it:
content=readallstr
content=Replace(content,chr(13),cha(28))
content=Replace(content,chr(13),cha(29))
content=Replace(content,chr(34),cha(18))
fso. output content
The principle is like this. In actual operation, most of the time, it is replaced by traversing with For len(content)
Last edited by baomaboy on 2007-4-15 at 01:39 AM ]
此帖被 +2 点积分 点击查看详情 评分人:【 kich 】 | 分数: +2 | 时间:2007-4-15 03:59 |
|
|

好多菩提树,好多明镜台。本来好多物,好多的尘埃。 |
|
2007-4-15 01:38 |
|
|
kich
中级用户
  
积分 397
发帖 168
注册 2006-10-8
状态 离线
|
『第 12 楼』:
使用 LLM 解释/回答一下
哦,原来是这样,晚上我回去试试看到底是怎么才能输出我想要的东西!!
谢谢指教!有什么不明白,我还来这里问问看啊!!
Thx
Oh, so that's how it is. I'll go back tonight and try to figure out how to output the thing I want!! Thanks for the advice! If I have any questions, I'll come back here to ask again!! Thx
|
|
2007-4-15 04:00 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 13 楼』:
使用 LLM 解释/回答一下
和单引不知道有什么关系,字符串里貌似只有""特殊罢了。
I don't know what the relationship is with single quotes. It seems that only "" is special in the string.
|
|
2007-4-15 05:12 |
|
|
kich
中级用户
  
积分 397
发帖 168
注册 2006-10-8
状态 离线
|
『第 14 楼』:
使用 LLM 解释/回答一下
有这样一个单引过滤好是好点我觉得!因为我想还转换其他的文本的呢!!
呵呵,谢谢各位指教!
There is such a single quote filtering. It's better. I think! Because I want to convert other texts too!!
Hehe, thank you all for your guidance!
|
|
2007-4-15 23:21 |
|
|
slore
铂金会员
      
积分 5212
发帖 2478
注册 2007-2-8
状态 离线
|
『第 15 楼』:
使用 LLM 解释/回答一下
"我是单引号 '你把我当字符串我没有被注释!"
你看上面的能被注释掉么?
"I am a single quote 'You treat me as a string and I am not commented out!'
Can the above be commented out?"
|
|
2007-4-16 00:13 |
|
|