1 頁 (共 1 頁)

Windows script: FindWindow/SetFWindow

文章發表於 : 週三 8月 25, 2004 8:09 pm
sm91kimo
想在MS Windows環境下寫個script,執行如下動作:
hWnd = FindWindow("^foobar");
SetForgroundWindow(hWnd);
也就是將 foobar2k 變成foreground(active) window。

在google找了很久的wscript/cscript/VBScript(/jsh)等Windows
Script資料,還是沒試出我想要的效果,MSDN的VBScript function
lists裡找不到FindWindow/SetForgroundWindow等函式。

請問Windows(XP)內建的script engine支援FindWindow/
SetForgroundWindow/SendKeys/...等Windows Automation
函式嗎?如果有範例可參考更好了。

先前我在WinCE(PPC2002)下使用nscriptm來達成自動化效果:
http://www.mobile01.com/topicdetail.php?f=129&t=4657
雖然nscriptm也有Win32版本,剛試了很久,發現Windows
Automation函式無法順利使用,也沒setfwindow這個函式。

google上找到了"Techniques for 'driving' Windows applications" 網頁:
http://wiki.tcl.tk/8813
看到免費的cwind,download解開後才發現是tcl/tk script,
還得裝Windows版本的tcl/tk。

如果要裝Win32 tcl/tk,那我寧願裝win32 perl,以前用過win32
perl好像有支援Windows Automation函式。只是不大情願為了
這麼簡單的功能裝很大的perl。

請問Windows(XP)環境有沒有類似nscriptm的工具(較強的.BAT)?
如果是內建的更好。