![]() |
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 17:09 |
47,813 topics / 349,918 posts / today 0 new / 48,274 members |
| DOS批处理 & 脚本技术(批处理室) » How can VBS input Chinese? |
| Printable Version 2,060 / 9 |
| Floor1 26933062 | Posted 2007-04-25 08:13 |
| 银牌会员 Posts 879 Credits 2,268 | |
|
─────────────────── Moderator Record ────────────────────
Handled by: bjsh Note: Because similar content was posted in , there is no need to make a new thread; Reminder: For questions with similar content, you can ask them in one post; just modify the title appropriately. Penalty: No penalty for now; a warning is given; please click here to read the forum posting rules, so as to avoid making rule-violating posts in future discussions. ─────────────────── Moderator Record ──────────────────── I copied a VBS for automatically logging into Chinagames, but I found that it doesn't work if the username is in Chinese. What should I do? hjd="""C:\Program Files\Chinagames\iGame\iGame.exe""" Set Ws=WScript.CreateObject("WScript.Shell") Ws.Run hjd WScript.Sleep 2000 Ws.SendKeys "+{TAB 2}" Ws.SendKeys "{bs 100}" Ws.SendKeys "//小楼一夜听春雨/" WScript.Sleep 1000 Ws.SendKeys "{TAB 2}" Ws.SendKeys "123456" WScript.Sleep 200 Ws.SendKeys "{ENTER}" [ Last edited by bjsh on 2007-4-24 at 07:51 PM ] |
|
| Floor2 zh159 | Posted 2007-04-25 13:11 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
The literal meaning of SendKeys is to send keyboard commands. Chinese won't work, so you can only try a different approach (looking into it...)
If the input line supports Ctrl+A Select All: Ws.SendKeys "^a{del}" (you can also skip {del} and directly use "^a123456", same below) then you don't need to use Ws.SendKeys "{bs 100}" If it does not support Ctrl+A Select All: If the input cursor is at the far right of the input line: Ws.SendKeys "+{left}{del}" If the input cursor is at the far left of the input line: Ws.SendKeys "+{right}{del}" [ Last edited by zh159 on 2007-4-25 at 12:22 AM ] |
|
| Floor3 lililulula | Posted 2007-04-25 23:25 |
| 中级用户 Posts 138 Credits 302 | |
|
Test environment: XP, after switching with ctrl+space the input method is Intelligent ABC
Output result: 小楼一夜听春雨 zhongwen="C:\WINDOWS\system32\cmd.exe" |
|
| Floor4 zh159 | Posted 2007-04-25 23:39 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
ctrl+space usually switches to the default first input method. Mine is "Ziguang Pinyin", so you have to switch according to your own usage pattern by using ctrl+space the needed number of times.
|
|
| Floor5 slore | Posted 2007-04-26 07:55 |
| 铂金会员 Posts 2,478 Credits 5,212 | |
|
Create an IE object, then you can use the clipboard ^
After copying the Chinese text to the clipboard, use VBS to send SENDKEYS the ctrl+V combination |
|
| Floor6 zh159 | Posted 2007-04-26 11:37 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
Originally posted by slore at 2007-4-25 18:55: Yes, I wrote one |
|
| Floor7 fengjing001 | Posted 2007-04-26 12:18 |
| 初级用户 Posts 37 Credits 69 | |
|
I hope these good things can be explained in detail. A newbie like me still can't understand them.
|
|
| Floor8 26933062 | Posted 2007-04-28 22:57 |
| 银牌会员 Posts 879 Credits 2,268 | |
|
Post #6, could you add an explanation after it?
Thanks, when I run your code, it says the line objIE.Quit has an error. If I remove that line it works, but it opens a blank webpage, very strange!!!! [ Last edited by 26933062 on 2007-4-28 at 10:03 AM ] |
|
| Floor9 zh159 | Posted 2007-04-28 23:23 |
| 金牌会员 Posts 1,467 Credits 3,687 | |
|
It needs IE support (I think IE has to be the default browser)
Actually it's about the same as a batch file, except that with objIE the characters are copied into the clipboard one by one using for |
|
| Floor10 kich | Posted 2007-08-16 16:11 |
| 中级用户 Posts 168 Credits 397 | |
|
Yeah! It seems that if Maxthon is the default browser, then it's difficult!!~~!
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |