【发布时间】:2014-06-23 20:03:31
【问题描述】:
我正在尝试学习 JScript(不是 javascript),但我在寻找资源时遇到了麻烦。我想要做的是操作 Windows shell 来创建一个操作其他程序的程序,所以我特别需要能够使用 Jscript 的 AppActivate() 函数在窗口之间切换焦点,但是它不起作用。我假设它不起作用,因为对 AppActivate 的调用是在我试图完全加载的窗口之前发生的?
有人可以吗:
给我一个在说,计算器和记事本之间切换的工作示例,也给我一些很好的参考资料?
另外,如何在执行结束时暂停程序,以便在命令提示符中读取错误?
这是我写的,每次都崩溃。
import System;
import System.Drawing;
import System.Windows.Forms;
import Accessibility;
//Open calculator, wait 3 seconds, open notepad, wait three seconds, change focus to calculator.
var WshShell = new ActiveXObject("WScript.Shell");
WshShell.Run("calc");
WshShell.Sleep(3000);
WshShell.Run("c:/windows/system32/notepad.exe");
WshShell.Sleep(3000);
AppActivate("calc");
【问题讨论】:
标签: jscript