WSH 윈도우즈 스크립트 호스팅
enzoy : 쇠털나날/지식?즐! - 질문과해결 : 2004/11/29 20:10 완젼 수동 입력 노가다를 해야 하는데, 윈도우즈 스크립팅 호스트로 가능할 것 같습니다.
저 좀 가르쳐주세요!
저 좀 가르쳐주세요!
진도르 (2004/11/29,12:42)
- 레코드 필드가 2개일때. 필드 사이는 스페이스.
시작하자마자 5초안에 포커스를 잽싸게 터미널 프로그램으로 옮겨라 : )
(아니면 밑의 5초 쉬는 코드 대신 WshShell.AppActivate("Program Name"); )
c:\entry.txt:
Annie 1
Steve 2
as400.js:
var WshShell = WScript.CreateObject("WScript.Shell");
var fs = new ActiveXObject("Scripting.FileSystemObject");
readonly = 1
f = fs.OpenTextFile("c:\\entry.txt", readonly);
line = f.ReadLine();
WScript.Sleep(5000);
while (line != '') {
p = line.indexOf(' ', 0);
name = line.substring(0, p);
q = line.indexOf(' ', p+1);
index = line.substring(p+1);
WshShell.SendKeys(name);
WScript.Sleep(500);
WshShell.SendKeys('\t');
WScript.Sleep(500);
WshShell.SendKeys(index);
WScript.Sleep(500);
WshShell.SendKeys('{ENTER}');
if (f.AtEndOfStream) break;
line = f.ReadLine();
}
f.Close();
enzoy (2004/11/30,11:14)
- 진도르 산신령님의 쏘오쓰에 감동을 먹고선 노트패드로 저도 좀 짜봤습니다.
(자바 스크립트도 모르는 놈이 노트패드로 짜고 _디!버!깅!_ 하느라 조금 고생... - -)
var WshShell = WScript.CreateObject("WScript.Shell");
var fs = new ActiveXObject("Scripting.FileSystemObject");
readonly = 1 ;
f = fs.OpenTextFile("c:\\entry.txt", readonly);
line = f.ReadLine();
WScript.Sleep(2000);
WshShell.AppActivate("Notepad");
while (1) { // while(1)따윈 맘에 안들지만 - -;;;
p = 0;
q = 0;
while (p != -1) {
p = line.indexOf('\t', q);
if (p == -1) entry = line.substring(q);
else entry = line.substring(q, p);
WshShell.SendKeys(entry);
WScript.Sleep(500);
WshShell.SendKeys('\t');
WScript.Sleep(1000);
q = p + 1;
}
WshShell.SendKeys('{ENTER}');
if (f.AtEndOfStream) break;
line = f.ReadLine();
}
f.Close();
아... 정말로 좋은 세상이로군요;;;
암런 컴파일러 등이 없어도 윈도우즈에 기본뽕으로 이것이 되다니 기쁩니다 흑흑흑.
Trackback Address :: http://blog.enzoy.pe.kr/trackback/287