Ruby charm: Ruby calls win32ole

Source: Internet
Author: User

How to use Ruby for Windows shell programming.

For example, create an Internet Explorer instance.

 

Require " Win32ole "   # Include library

IE = Win32ole. New ( ' Internetexplorer. Application ' )
Ie. Visible = True # At this time, we can see an IE interface.
Ie. navigate ( ' Http://mail.163.com ' ) # Go to this page
Sleep ( 0.1 ) Until IE. Busy = False # Sleep until IE. Busy is false and the page is fully loaded.
Ie. Document. getelementbyid ( " Username " ). Value =   " Coderlee "   # Enter account name
Ie. Document. getelementbyid ( " Password " ). Value =   " ****** "   # Enter Password
Ie. Document. getelementbyid ( " Btn1 " ). Click # The login button ID is btn1 simulated click

In fact, you can use interactive programming to find a created OLE object and enter. ole_methods.

It's very convenient.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.