查看: 1165|回复: 7

[已经解决] 还是事件中的脚本问题

  [复制链接]
梦石
0
星屑
50
在线时间
1 小时
注册时间
2009-7-7
回帖
122
发表于 2009-10-18 12:50:01 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

您需要 登录 才可以下载或查看,没有账号?注册会员

×
本帖最后由 NOSCBY 于 2009-10-18 12:51 编辑

在事件中使用一段脚本,实现打开XX文件。
例如说打开Record/记录.txt

注意了,是直接打开,不是在RMplayer中读!
梦石
0
星屑
61
在线时间
24 小时
注册时间
2008-8-5
回帖
1912
发表于 2009-10-18 13:16:23 | 显示全部楼层
本帖最后由 紫苏 于 2009-10-18 13:19 编辑

建议用英文命名文件,这样就不用做 Unicode 的转码了,直接:
  1. ShellExecute = Win32API.new("shell32", "ShellExecute", "LPPPPI", "L")
  2. ShellExecute.call(0, "open", "Record\\1.txt", 0, 0, 1)
复制代码
回复

使用道具 举报

梦石
0
星屑
50
在线时间
1 小时
注册时间
2009-7-7
回帖
122
 楼主| 发表于 2009-10-18 13:20:32 | 显示全部楼层
建议用英文命名文件,这样就不用做 Unicode 的转码了,直接:ShellExecute = Win32API.new("shell32", "ShellExecute", "LPPPPI", "L")
ShellExecute.call(0, "open", "Record\\1.txt", 0, 0, 1) ...
紫苏 发表于 2009-10-18 13:16


难道还要我一个个的去改么?
如果要转码的话怎么做呢?
回复

使用道具 举报

梦石
0
星屑
61
在线时间
24 小时
注册时间
2008-8-5
回帖
1912
发表于 2009-10-18 13:26:05 | 显示全部楼层
那就:
  1. class String
  2.   @@MultiByteToWideChar = Win32API.new("kernel32", "MultiByteToWideChar", ['I', 'L', 'P', 'I', 'P', 'I'], 'I')
  3.   def to_unicode
  4.     len = @@MultiByteToWideChar.call(65001, 0, self, -1, 0, 0) << 1
  5.     buf =" " * len
  6.     # 65001: UTF-8 字符集编码(代码页)
  7.     @@MultiByteToWideChar.call(65001, 0, self, -1, buf, len)
  8.     return buf
  9.   end
  10. end

  11. ShellExecute = Win32API.new("shell32", "ShellExecuteW", "LPPPPI", "L")
  12. ShellExecute.call(0, "open".to_unicode, "Record\\记录.txt".to_unicode, 0, 0, 1)
复制代码
回复

使用道具 举报

梦石
0
星屑
50
在线时间
1 小时
注册时间
2009-7-7
回帖
122
 楼主| 发表于 2009-10-18 13:33:03 | 显示全部楼层
事件中的只能插入12行,这个13行了
回复

使用道具 举报

梦石
0
星屑
61
在线时间
24 小时
注册时间
2008-8-5
回帖
1912
发表于 2009-10-18 13:34:04 | 显示全部楼层
class ... end 部分放进脚本编辑器任意处
回复

使用道具 举报

梦石
0
星屑
50
在线时间
1 小时
注册时间
2009-7-7
回帖
122
 楼主| 发表于 2009-10-18 13:39:27 | 显示全部楼层
如何调用
回复

使用道具 举报

℃ake

梦石
0
星屑
50
在线时间
8 小时
注册时间
2009-6-6
回帖
670
发表于 2009-10-18 14:08:35 | 显示全部楼层
如何调用
NOSCBY 发表于 2009-10-18 13:39

class和end写入脚本编辑器,下面这两句
ShellExecute = Win32API.new("shell32", "ShellExecuteW", "LPPPPI", "L")

ShellExecute.call(0, "open".to_unicode, "Record\\记录.txt".to_unicode, 0, 0, 1)
这两句不用写入脚本编辑器,直接在事件里调用。
我爱66RPG,但我讨厌66.
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部