Results 1 to 7 of 7

Thread: Control a software

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    2

    Control a software

    Hi, i'm very new with visual basic.
    Would like to know if it's possible to control a software. For example, open Word, type some words in a document, go to the edition menu, change the font, and then save the document ?

    How would it be done ?

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Control a software

    Welcome to the forums.

    Set a reference to the Microsoft Word Object Library. Run this
    VB Code:
    1. Dim objWord As Word.Application
    2. Set objWord = New Word.Application
    3. objWord.Visible = True
    4. objWord.Documents.Add
    Type whatever you want to type, do whatever you want to do, then click on the File/Save menu from Word.

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2005
    Posts
    2

    Re: Control a software

    hum,... no. I want my little vb program to 'click on the file/save menu' from word and save the document. I want to know if litteraly I can 'control' a software, as if the mouse was moving all by itself.

  4. #4
    Smitten by reality Harsh Gupta's Avatar
    Join Date
    Feb 2005
    Posts
    2,938

    Re: Control a software

    Quote Originally Posted by lepetitcrabe
    hum,... no. I want my little vb program to 'click on the file/save menu' from word and save the document. I want to know if litteraly I can 'control' a software, as if the mouse was moving all by itself.
    you may use Hack's suggestion for opening Word App and then use SendKeys function for Saving the document.
    Show Appreciation. Rate Posts.

  5. #5
    Hyperactive Member
    Join Date
    Feb 2003
    Location
    Grenada
    Posts
    346

    Re: Control a software

    There is a way... I made a program that does something like that. It was basically for an automated learning presentaion that shows you literally what to click, where to click and to an extent HOW to click it and the results...

    BUT trust me.. it's not that easy... it requires getting the classname, title and handle of the window... enumerating through all the windows... getting the mouse cursor position and setting it... and the toughest of all... making sure the user does not move the mouse cause you will get a little mouse struggle...

    SO unless you're an expert in VB then I suggest going for the simple and referencing MSWO Library as Hack said...

    If I can still get my hands on the coding I used I'll upload it...
    If my post has been helpful, then please rate it accordingly...
    If it has solved your question(s), then don't forget to mark the thread as "[Resolved]"... thank you.

  6. #6
    Hyperactive Member vbcode1980's Avatar
    Join Date
    Nov 2005
    Location
    Anywhere the wind blows
    Posts
    365

    Re: Control a software

    Using the reference Hack has given, it is possible to call the Save function.

    Unless you really want to 'control' the mouse, but that will be harder.
    You'll have to determine the position of the menu first.
    I code C#....

  7. #7
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Control a software

    Quote Originally Posted by vbcode1980
    Using the reference Hack has given, it is possible to call the Save function.

    Unless you really want to 'control' the mouse, but that will be harder.
    You'll have to determine the position of the menu first.
    Exactly!

    You can use either a FileSaveAs or a FileSave right from within your code.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width