locked
VB Script RRS feed

  • Question

  • Hello, I created a vb script to automate mouse clicks for an application. The script works all along but the last line is not working. I am really confused why would that be if the rest of it is working. I want to click CTRL+K, but somehow this is not working. Here is the code. Need some somehelp. Thanks.1

    Option Explicit
    Dim x
    set x=createobject("wscript.shell")

    x.run"C:\OnBasewebsite\obclnt32.exe"
    wscript.sleep 2000
    x.sendkeys"MANAGER"
    x.sendkeys"{tab}"
    x.sendkeys"PASSWORD"
    x.sendkeys"{enter}"
    wscript.sleep 2000
    x.sendkeys"{TAB}"
    x.sendkeys"{UP}"
    x.sendkeys"{TAB}"
    x.sendkeys"{TAB}"
    x.sendkeys"{TAB}"
    x.sendkeys"{TAB}"
    x.sendkeys"{TAB}"
    x.sendkeys"{TAB}"
    x.sendkeys"{TAB}"
    x.sendkeys"{TAB}"
    x.sendkeys"{TAB}"
    x.sendkeys"*-*"
    x.sendkeys"{enter}"
    x.sendkeys"{TAB}"
    x.sendkeys"{enter}"
    wscript.sleep 1000
    x.sendkeys"{CLICK LEFT,50,60}"
    x.sendkeys"^k"

    Thursday, December 5, 2013 6:51 PM

Answers

  • Search this forum for 'sendkeys' and you will find numerous search results that do not recommend the sendkeys method for automation. There are too many things that can happen that can break it.

    It is much better to explain your purpose/goal, not your attempted solution.

    Bill

    • Marked as answer by Bill_Stewart Thursday, January 2, 2014 9:31 PM
    Thursday, December 5, 2013 8:00 PM