HOME | DD

KeybrdCowboy — Tutorial About VBS AppActivate Method and SendKeys

Published: 2013-01-06 11:52:02 +0000 UTC; Views: 2305; Favourites: 0; Downloads: 15
Redirect to original
Description I made a better post here [link]


This Post Works Ok As Well

So I noticed that esc will close the program
so I used SendKeys... but the program did not
seem to have the focus..

So I added the focus
objshell.AppActivate "Irfanview"

This Newer Method Is Working Fine... Check Out The .vbs script below
I added wall.exe and the run2.vbs script to a SFX executable


The Wall.exe resets the wallpaper

I used Batch To EXE On Wall.cmd To Make Wall.exe

Wall.cmd
...........................................................................................
"C:/Program Files/IrfanView/i_view32.exe" "%AppData%Microsoft/Windows/Themes/TranscodedWallpaper.jpg /wall=2"
............................................................................................


run2.vbs
........................................................................................

Dim objShell, WshShell, IrfanView

currentDirectory = left(Wscript.ScriptFullName,(Len(Wscript.ScriptFullName))-(len(Wscript.ScriptName)))
set objShell = Wscript.CreateObject("Wscript.Shell")
objshell.run "wall.exe", 1
objshell.AppActivate "Irfanview"
Wscript.sleep 800
objshell.SendKeys "{ESCAPE}"

Wscript.quit

.........................................................................................

Better To Use This Newer Method... To Get
that.... IrfanView App... To Close

The newer method works better...
AppActivate and the ESC Key....
see the .vbs script above.


Sometimes it's good to have an example of vbscript
around as a reference... That is why I am keeping
this version of this script around.
Related content
Comments: 0