GENESIS32: Scriptเรียกใช้โปรแกรมต่างๆ ถ้าโปรแกรมนั้นเปิดอยู่ก็ให้แสดงโปรแกรมนั้น หรือถ้ายังไม่ได้เปิดก็ให้เปิดขึ้นมา

34 views
Skip to first unread message

GEN32

unread,
Jan 22, 2015, 1:17:57 AM1/22/15
to genesis...@googlegroups.com
GENESIS32: Scriptเรียกใช้โปรแกรมต่างๆ ถ้าโปรแกรมนั้นเปิดอยู่ก็ให้แสดงโปรแกรมนั้น หรือถ้ายังไม่ได้เปิดก็ให้เปิดขึ้นมา

โดยปกติGENESIS32สามารถใช้Dynamic Pick เพื่อเรียกโปรแกรมต่าง ๆ ได้อยู่แล้ว แต่หากต้องการScriptเรียกใช้โปรแกรมต่างๆ ถ้าโปรแกรมนั้นเปิดอยู่ก็ให้แสดงโปรแกรมนั้น หรือถ้ายังไม่ได้เปิดก็ให้เปิดขึ้นมาก็สามารถใช้VBScriptดังนี้ (ตัวอย่างนี้เรียกใช้โปรแกรมNotepad)


strAppName = "%WinDir%\NOTEPAD.EXE" 'This is the path and name of the application 
strWindowsHandle = "Untitled - Notepad" 'This is the text of the titlebar of the window 

Set WshShell = CreateObject("WScript.Shell") 

If WshShell Is Nothing Then 
MsgBox "Unable to create WScript.Shell Object!" & vbCrLf & _ 
"You must have Windows 2000 or newer." 
Else 
If Not WshShell.AppActivate (strWindowsHandle) Then 
Call WshShell.Run(strAppName) 
End If 
Set WshShell = Nothing 
End If
Reply all
Reply to author
Forward
0 new messages