Vbscript 在时间轴VBS上运行和关闭程序

Vbscript 在时间轴VBS上运行和关闭程序,vbscript,Vbscript,我正在尝试制作一个vb脚本,打开一个应用程序,然后点击设置点让应用程序工作,然后在15分钟后关闭程序,但我不知道如何,也不知道如何让它工作 到目前为止我有这个 Set WshShell = WScript.CreateObject("WScript.Shell") WshShell.Run "C:\Users\Owner\Downloads\Codin\Codin\Codin.exe" //Now it doesn't run for some reason, it won't open the

我正在尝试制作一个vb脚本,打开一个应用程序,然后点击设置点让应用程序工作,然后在15分钟后关闭程序,但我不知道如何,也不知道如何让它工作

到目前为止我有这个

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "C:\Users\Owner\Downloads\Codin\Codin\Codin.exe"
//Now it doesn't run for some reason, it won't open the program in my downloads?
//right here is where I'd put the script for the clicking on certain areas
//then put the time script above this
Set WshShell = WScript.CreateObject("Wscript.Shell")
WshShell.run "C:\Users\Owner\Downloads\Codin\Codin.bat\\
//The .bat file is to run
@ECHO OFF
TASKKILL /F /IM Codin.exe

移动鼠标并强制鼠标单击可以创建一个新的窗口

但是,您可以尝试以下方法:

Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Long, ByVal dX As Long, ByVal dY As Long, ByVal cButtons As Long, ByVal dwExtraInfo As Long)
Process.Start("C:\Users\Owner\Downloads\Codin\Codin\Codin.exe")
Dim x As Integer = 150 ' The x position on the screen
Dim y As Integer = 150 ' The y position on the screen
Cursor.Position = New Point(x, y) 
mouse_event MOUSEEVENTF_LEFTDOWN Or MOUSEEVENTF_LEFTUP, x, y, 0, 0
Application.DoEvents()
Threading.Thread.Sleep(900000) ' Sleep 900,000 milliseconds, or 15 minutes
Process.Start("C:\Users\Owner\Downloads\Codin\Codin.bat")
您可能必须在vb.NET中执行此操作,因为VBS不支持vb.NET所支持的许多函数,您可以将其封装在可执行文件中

有关强制鼠标单击方法的详细信息: