我正在尝试创建一个打开应用程序的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
答案 0 :(得分:0)
移动鼠标并强制点击鼠标可以创建hostile user environment。
但是你可以试试这个:
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所执行的许多功能,您可以将其包装在可执行文件中。
有关强制鼠标点击方法的更多信息:https://bytes.com/topic/visual-basic/answers/641974-force-mouse-click