access the title of a window using vbscript

匿名 (未验证) 提交于 2019-12-03 09:52:54

问题:

I'm trying to get the title of a window using VbScript. Is there any way to achieve it? like the way we do it in C#

using System.Diagnostics;  Process[] processlist = Process.GetProcesses();  foreach (Process process in processlist) {     if (!String.IsNullOrEmpty(process.MainWindowTitle))     {         Console.WriteLine("Process: {0} ID: {1} Window title: {2}",                            process.ProcessName, process.Id, process.MainWindowTitle);     } }

回答1:

Dim Tasks     Tasks = Split(WScript.CreateObject("WScript.Shell").Exec("tasklist /v /fo csv").StdOut.ReadAll(),vbCrLf)  Dim task     For Each task In Tasks         task = Split(Trim(task),",")         If Ubound(task) >= 8 Then             WScript.Echo "Process " + task(0) + "ID: " + task(1) + " Title: " + task(8)         End If     Next 


标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!