The automatic sign-In program of the WPF edition.

Source: Internet
Author: User

The automatic sign-In program of the WPF edition.

1. What kind of trouble does the outsourcing company sign in the morning? Don't sign in, don't deduct money, don't sign in and don't give money. To help you get rid of it, I wrote an automatic punching program.

2. I always wanted to write this program, but I had no idea. I knew that a software company was asking me for an automatic Q & A program, so the automatic punching program came into being. In the future, you can view the automatic Q & A program open-source experts.

3. Because the company uses enterprise domain authentication, you must first Authenticate and then use webbrower to simulate manual operations.

The references are as follows:

C # How to Implement Automatic Webpage form filling

4. Set the website address for webBrowser

WebBrowser1.Source = new Uri (txtUrl. Text );

Then enable the monitoring thread

Thread t1 = new Thread (new ThreadStart (Start) {IsBackground = true };
T1.Start ();

The implementation of start is as follows:

# Region thread entry method // <summary> // thread entry method // </summary> public void Start () {this. dispatcher. invoke (DispatcherPriority. normal, (ThreadStart) delegate () {btnStart. isEnabled = false; lblStart. content = "running ...... ";}); while (true) {DakaType dakaType = DakaType. unknown; this. dispatcher. invoke (DispatcherPriority. normal, (ThreadStart) delegate () {webBrowser1.Source = new Uri (txtUrl. text) ;}); Thread. sleep (TimeSpan. fr OmSeconds (10); this. dispatcher. invoke (DispatcherPriority. normal, (ThreadStart) delegate () {if (DateTime. now. hour = 8 & DateTime. now. minute> 30) {dakaType = DakaType. work; mshtml. IHTMLDocument2 document1 = (mshtml. IHTMLDocument2) webBrowser1.Document; mshtml. IHTMLElement = (mshtml. IHTMLElement) document1.all. item ("amGoUnite", 0); if (go to work! = Null) {work. click () ;}} if (DateTime. now. hour = 18) {dakaType = DakaType. off duty; mshtml. IHTMLDocument2 document = (mshtml. IHTMLDocument2) webBrowser1.Document; mshtml. IHTMLElement off duty = (mshtml. IHTMLElement) document. all. item ("pmBackHome", 0); if (off work! = Null) {off duty. click () ;}}); if (dakaType = DakaType. work) {Thread. sleep (TimeSpan. fromMinutes (1);} else if (dakaType = DakaType. off duty) {Thread. sleep (TimeSpan. fromMinutes (20);} else {Thread. sleep (TimeSpan. fromMinutes (10) ;}}# endregion

Code Description

Mshtml. IHTMLDocument2 document = (mshtml. IHTMLDocument2) webBrowser1.Document; mshtml. IHTMLElement off duty = (mshtml. IHTMLElement) document. all. item ("pmBackHome", 0 );
Find the "pmBackHome" button on the page and click
If (Off duty! = Null) {work. click ();}

Set to work after half past eight every day and work after.

Website

On the program startup page, enter the domain account and password and click Start.

 

Interface after login

 

Click Start.

 

Then the program is enabled and put on the server.

Download

 

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.