Jump to content

Recommended Posts


Posted

Could you provide more infomation about what you want.

Here is a Vbs Script that uses AppActivate and SendKeys Method

1:\ Open Notepad

2:\ Add Some Text

3:\ Save And Closes the new Text flle

AppActivate And Sending Keystrokes to a Program

Save As Demo_SendKey.vbs


Dim Act :Set Act = CreateObject("Wscript.Shell")
Act.Run("Notepad.exe"),1,False
Do Until Success = True
Success = Act.AppActivate("Notepad")
Wscript.Sleep 1000
Loop

Act.SendKeys "This is a test of AppActivate."
WScript.Sleep 1000
Act.SendKeys "{ENTER}"
Act.SendKeys "T" :WScript.Sleep 500
Act.SendKeys "e" :WScript.Sleep 500
Act.SendKeys "s" :WScript.Sleep 500
Act.SendKeys "t" :WScript.Sleep 500
Act.SendKeys "%F"
Act.SendKeys "{DOWN}" :WScript.Sleep 500
Act.SendKeys "{DOWN}" :WScript.Sleep 500
Act.SendKeys "{DOWN}" :WScript.Sleep 500
Act.SendKeys "{ENTER}" :WScript.Sleep 500
Act.SendKeys "Demo_Send_Key.txt"
Act.SendKeys "{ENTER}",500
Act.SendKeys "%F" :WScript.Sleep 1000
Act.SendKeys "{DOWN}" :WScript.Sleep 500
Act.SendKeys "{DOWN}" :WScript.Sleep 500
Act.SendKeys "{DOWN}" :WScript.Sleep 500
Act.SendKeys "{DOWN}" :WScript.Sleep 500
Act.SendKeys "{DOWN}" :WScript.Sleep 500
Act.SendKeys "{DOWN}" :WScript.Sleep 500
Act.SendKeys "{ENTER}" :WScript.Sleep 500

Rename Demo_SendKey.vbs.txt to Demo_SendKey.vbs to make active.

Demo_SendKey.vbs.txt

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...