1.

Solve : Wscript/cscript help?

Answer»

Hi all!

I have a small question:

How would i go about AUTOMATING mouse clicks sing a .vbs file?

I know that the following saves a notepad file, but how can i use the same language and method to make the mouse click?

Code: [Select]set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 10
WshShell.AppActivate "wordola.txt"
WScript.Sleep 10
WshShell.SendKeys "%"
WScript.Sleep 0.1
WshShell.SendKeys "{DOWN}"
WScript.Sleep 0.1
WshShell.SendKeys "{DOWN}"
WScript.Sleep 0.1
WshShell.SendKeys "{DOWN}"
WScript.Sleep 0.1
WshShell.SendKeys "~"
WScript.Sleep 10

Thanks in Advance,

kamakyou can read more here http://msdn.microsoft.com/en-us/library/aa922603.aspxQuote from: diablo416 on July 25, 2008, 08:25:18 AM

you can read more here http://msdn.microsoft.com/en-us/library/aa922603.aspx

How would i implement that into a .vbs file like my example above?Quote
How would i implement that into a .vbs file like my example above?

You probably wouldn't unless you've gone mobile!

Consider which control has focus; then consider how many times you have to HIT the TAB key to give the control in question focus. Once the the control has focus, send the enter key (same as a mouse click in this context).

Microsoft might have had a great editor if they'd made notepad scriptable. Instead only the CLUNKY sendkeys method seems to work. You can make menu choices with sendkeys by using alt+underline letter (atl-f for file or alt+e for edit etc) to grab the menu, or use the menu shortcuts to do things like save (ctl-s) or paste (ctl-v), etc.

Are you sure the WshShell.AppActivate "wordola.txt" is correct? That does not appear to be the window title for notepad.



Discussion

No Comment Found