Web page capture JavaScript processing

Source: Internet
Author: User

During webpage capturing, many webpage content is pre-stored in Javascript variables. If only substring is used for screenshot analysis, the efficiency is slow and the error rate is high.

How can we better solve this problem? Use msscriptcontrol

 

In C #, we can also use the COM component to execute JavaScript code.

The following code demonstrates how to use the msscriptcontrol component to execute a mathematical expression:

Msscriptcontrol. scriptcontrolclass SC = new msscriptcontrol. scriptcontrolclass ();
SC. Language = "JavaScript ";
Object OBJ = SC. eval ("1 + 2*(3 + 4 )");
Console. writeline (OBJ );

To use msscriptcontrol, you must reference the COM component Microsoft Script Control 1.0.

The previous article has already explained in detail that, of course, there are some errors in the Code: "msscriptcontrol. iscriptcontrol. Timeout" and "msscriptcontrol. dscriptcontrolsource_event.timeout ".

Original code:

 

/// <Summary>

/// Obtain or set the script execution time, in milliseconds

/// </Summary>

Public int timeout

{

Get {return this. MSC. Timeout ;}

Set {This. MSC. Timeout = value ;}

}

To:

 

/// <Summary>

/// Obtain or set the script execution time, in milliseconds

/// </Summary>

Public int timeout

{

 

Get {return (iscriptcontrol) This. MSC). Timeout ;}

Set {(iscriptcontrol) This. MSC). Timeout = value ;}

 

}

You can use the test. This makes it easier to capture data and directly output the JS results.

You can combine some technologies to do many things, such:

1. Alexa ranking cheating. After the EXE executes the processing, it can post it, or apply for a certificate for page processing.

2. Click or display advertisement cheating. The principle is the same as above. Combined with ActiveX plug-ins, the effect is good.

ActiveX is Microsoft's name for a series of strategic object-oriented program technologies and tools. The main technology is Component Object Model (COM ). In a directory and other supported networks, com becomes a Distributed COM (DCOM ). When creating ActiveX programs, the main task is to create components, a program that can be self-contained in ActiveX networks (the current network mainly includes Windows and Mac. This component is the ActiveX near control. ActiveX was proposed by Microsoft to compete with Sun Microsystems's Java technology. Its functions are similar to those of Java applet.

 

If you are using a Windows operating system, you may notice some files ending with OCX. OCX stands for "Object link and embedded control" (OLE), a program technology proposed by Microsoft for processing desktop files. Now the concept of COM has replaced part of OLE, and Microsoft also uses ActiveX controls to represent component objects.

 

A major advantage of components is that they can be reused by most applications (these applications are called component containers ). A com component (ActiveX Control) can be developed by development tools in different languages, including C ++, Visual Basic or Powerbuilder, and even some technical languages such as VBScript.

 

Currently, ActiveX controls are run in Windows 95/NT and Macintosh, and Microsoft is also preparing to support UNIX ActiveX controls.

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.