Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: VB Script for windows application  (Read 2966 times)

0 Members and 1 Guest are viewing this topic.

yanng1

    Topic Starter


    Beginner

    VB Script for windows application
    « on: December 18, 2007, 01:40:16 PM »
    I would like to wow my dad for xmas and write him a script which:

    1. Runs the windows remote desktop application (comes w/ vista).
    2. Enters the ip for the remote machine.
    3. Enters his user profile.
    4. Enters his password.
    5. Completes the connection.

    I don't believe this kind of script is supposed to be difficult.
    The task of doing it manually is not very difficult.
    But then, I'm new to VB script. Any suggestions?

    Thanks in advance

    Sidewinder



      Guru

      Thanked: 139
    • Experience: Familiar
    • OS: Windows 10
    Re: VB Script for windows application
    « Reply #1 on: December 18, 2007, 06:25:16 PM »
    I couldn't find a WMI class for remote desktop, so this is not very elegant:

    Code: [Select]
    Set WshShell = WScript.CreateObject("WScript.Shell")
    WshShell.Run "mstsc /v:Computer /w:800 /h:600 /console"
    WshShell.AppActivate "Remote Desktop Connection"
    WScript.Sleep 1000
    WshShell.SendKeys "Signon"
    WScript.Sleep 1000
    WshShell.SendKeys "{tab}"
    WScript.Sleep 1000
    WshShell.SendKeys "Password"
    WScript.Sleep 1000
    WshShell.SendKeys "{enter}"

    Change Computer to a real computer name, Signon to a real logon id and Password to a real password.

    Like I said, not elegant but serviceable. I'm sure your Dad will be thrilled to get a script for Christmas. ;)
    The true sign of intelligence is not knowledge but imagination.

    -- Albert Einstein