Dim notepadID As Integer
' To activate a running Notepad process use the following command
AppActivate ("Untitled - Notepad")
' If you want to create a new instance and active that process please follow the following steps
notepadID = Shell("NOTEPAD.EXE", 1)
' Activate the new instance of Notepad.
'AppActivate (notepadID)
SendKeys "Hello, RiskSpan team is in full Action", TrueSendKeys "~", True
SendKeys "TechTalk", True
This piece of code opens a new Notepad instance and prints the text as
Hello, RiskSpan team is in full Action
TechTalkAnd to invoke calculator and do some calculation
Sub Main()
Dim ReturnValue, I
ReturnValue = Shell("calc.exe", 1) ' Run Calculator.
AppActivate ReturnValue ' Activate the Calculator.
For I = 1 To 100 ' Set up counting loop.
SendKeys I & "{+}", True ' Send keystrokes to Calculator
Next I ' to add each value of I.
SendKeys "=", True ' Get grand total.
SendKeys "%{F4}", True ' Send ALT+F4 to close Calculator.
End Sub
'Ipconfig
Guys please keep one thing in mind, this will not work if you debug, keep a break point at the end of the procedure/Function
Dim cmdId As Integer
cmdId = Shell("CMD.EXE", 1)
' Activate the new instance of Notepad.
AppActivate cmdId
SendKeys "ipconfig /all {ENTER}", True
Similar articles:
http://articles.techrepublic.com.com/5100-10878_11-1056137.html
No comments:
Post a Comment