| 赞 | 274 |
| VIP | |
| 好人卡 | |
| 积分 | 496 |
| 经验 | |
| 最后登录 | 2024-6-21 |
| 在线时间 | 1919 小时 |
- 梦石
- 10
- 星屑
- 39550
- 在线时间
- 1919 小时
- 注册时间
- 2010-11-14
- 回帖
- 3214

|
发表于 2023-1-26 22:52:31
|
显示全部楼层
本帖最后由 KB.Driver 于 2023-1-31 20:52 编辑
(1)这两段插入脚本编辑器
[pre lang="ruby"]class String
CP_ACP = 0
CP_UTF8 = 65001
MultiByteToWideChar = Win32API.new(*%w[kernel32 MultiByteToWideChar ilpipi i])
WideCharToMultiByte = Win32API.new(*%w[kernel32 WideCharToMultiByte ilpipipp i])
def utf8_to_gb2312
n = 0
i = MultiByteToWideChar.call(CP_UTF8, 0, self, -1, nil, 0)
buffer = "\0" * (i * 2)
MultiByteToWideChar.call(CP_UTF8, 0, self, -1, buffer, i)
i = WideCharToMultiByte.call(CP_ACP, 0, buffer, -1, nil, 0, nil, nil)
result = "\0" * i
WideCharToMultiByte.call(CP_ACP, 0, buffer, -1, result, i, nil, nil)
result.chop!
return result
end
def gb2312_to_utf8
n = self.size
i = MultiByteToWideChar.call(CP_ACP, 0, self, n+1, nil, 0)
buffer = "\0" * (i*2)
i = MultiByteToWideChar.call(CP_ACP, 0, self, n+1, buffer, i)
i = WideCharToMultiByte.call(CP_UTF8, 0, buffer, -1, nil, 0, nil, nil)
result = "\0" * i
WideCharToMultiByte.call(CP_UTF8, 0, buffer, -1, result, i, nil, nil)
result.chop!
return result
end
end[/pre]
[pre lang="ruby"]GetForegroundWindow = Win32API.new(*%W[user32.dll GetForegroundWindow v l])
MessageBox = Win32API.new(*%W[user32.dll MessageBox lppl l])
Hwnd = GetForegroundWindow.call[/pre]
(2)事件脚本用这个
[pre lang="ruby"]text = "测试文本\n\n这是第二行"
title = "测试标题"
MessageBox.call(Hwnd, text.utf8_to_gb2312, title.utf8_to_gb2312, 48)[/pre]
(3)效果参考
RM自身的报错
使用脚本的效果,是不是一模一样?
可以用事件脚本触发,编辑文字显示不同内容
|
|