IE browser to add "copy image Address" of the right key menu of the VBS code _VBS

Source: Internet
Author: User
But IE and with IE shared right menu Myie, Sogou and other browsers do not copy the image link address shortcut menu, usually only select the attributes of the picture and then in the Properties dialog box to copy the picture address, very troublesome!
Below we add to ie a "Copy image address" Right-click menu, the steps are as follows:
VB new ActiveX DLL project, project name: Netcopyurl, the default generated class name is changed to Clscopyurl
Add the following code to the CLSCOPYURL.CLS:
Public Sub Copyimageurl (URL as String)
Clipboard.clear
Clipboard.settext URL
End Sub
Execute file->make NetCopyURL.dll generate dynamic link library files NetCopyURL.dll
Copy NetCopyURL.dll to C:\Windows\System32 folder
Run start-> All Programs-> Attachment-> command prompt, enter the following command to register Dll:regsvr32 C:\Windows\System32\NetCopyURL.dll
Open Notepad, typing the following, and storing to C:\Program files\copyimageurl\copyurl.htm. This is the VBScript script to be executed by the right mouse menu.
Copy Code code as follows:

<script language= "VBscript" >
Sub OnContextMenu ()
On Error Resume Next
Set srcevent = External.menuArguments.event
Set eventelement = External.menuArguments.document.elementFromPoint (Srcevent.clientx, Srcevent.clienty)
Set Objnet=createobject ("Netcopyurl.clscopyurl")
Objnet.copyimageurl (EVENTELEMENT.HREF)
End Sub
Call OnContextMenu ()
</script>

Finally, add a right-click menu to IE in the registry: Create a new reg file in any location, such as Addmenu.reg, and then typing the following:
Copy Code code as follows:

Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet explorer\menuext\ Copy Image Address (&x)]
@= "C:\\Program Files\\copyimageurl\\copyurl.htm"
"Contexts" =dword:0000002

After saving, double-click the Addmenu.reg file to import the registry key, completing the Add to the right-click menu.
The value of the contexts written to the registry in step 7th represents the right-click menu that appears when you click on the object in IE, with the following meanings (can be combined):
0x01 default
0x02 Pictures
0x04 Control
0x08 form fields
0x10 Select text
0x20 hyperlink
Such as:
CONTEXTS=0X000002, the right click menu when you right-click the picture in IE
contexts=0x000022, the right key menu that appears when you right-click a picture or hyperlink in IE
OK, re-open ie, open a page with pictures, right-click on the picture, the menu appears in the "Copy Image Address (&x)" menu item, select the menu command, the picture's link address was copied.
Change the contents of the copyurl.htm to the following code, omitting the first 5 steps. (That is, no more ActiveX DLLs are required)
<script language= "VBscript" >
Sub OnContextMenu ()
Set srcevent = External.menuArguments.event
Set eventelement = External.menuArguments.document.elementFromPoint (Srcevent.clientx, Srcevent.clienty)
Set cpbobj = External.menuArguments.clipboardData
Call Cpbobj.setdata ("Text", Eventelement.href)
End Sub
Call OnContextMenu ()
</script>
Produced an installation file, download decompression, right click Copyimageurl.inf, select "Install" can be. Open a Web page with a picture, right-click on the picture, the menu item "Copy image address (&x)" appears in the menu, select the menu command, the link address of the picture is copied. Installation File Download Address:
Copyimageurl.zip

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.