In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly introduces how to use vbs to achieve IE browser to add copy image address right-click menu, the article is very detailed, has a certain reference value, interested friends must read it!
However, IE and browsers such as MyIE and Sogou, which share right-click menus with IE, do not copy the shortcut menu of the image link address, so it is very troublesome to select the properties of the picture and then copy the picture address in the properties dialog box.
Let's add a "copy image address" right-click menu to IE, as follows:
VB create a new ActiveX Dll project, project name: NetCopyURL, and change the default generated class name to clsCopyURL
Add the following code to clsCopyURL.cls:
Public Sub CopyImageURL (URL As String)
Clipboard.Clear
Clipboard.SetText URL
End Sub
Execute File- > Make NetCopyURL.dll to generate the dynamic link library file NetCopyURL.dll
Copy NetCopyURL.dll to the C:\ Windows\ System32 folder
Run start-> all programs-> attachments-> Command prompt, enter the following command to register dll:Regsvr32 C:\ Windows\ System32\ NetCopyURL.dll
Open notepad, type the following, and save it to C:\ Program Files\ CopyImageUrl\ CopyUrl.htm. This is the VBScript script to be executed from the right-click menu.
The copy code is as follows:
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 ()
Finally, add a right-click menu to IE in the registry: create a new reg file, such as AddMenu.reg, anywhere, and type in the following:
The copy code is 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 to complete the addition of the right-click menu.
The value of Contexts written to the registry in step 7 represents the right-click menu that appears when you right-click on which object in IE. The specific meaning is as follows (combinable):
0x01 default
0x02 Picture
0x04 control
0x08 form field
0x10 Select text
0x20 hyperlink
Such as:
Contexts=0x000002, indicating the right-click menu that appears when you right-click a picture in IE
Contexts=0x000022, indicating the right-click menu that appears when you right-click a picture or hyperlink in IE
Ok, reopen IE, 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, and the link address of the picture is copied.
Change the content of CopyUrl.htm to the following code to omit the first five steps. (that is, no need to do ActiveX DLL anymore)
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 ()
After making an installation file, download and decompress it, right-click CopyImageUrl.inf and select "install". Open a web page with a picture, right-click on the picture, and the menu item "copy Image address (& X)" appears in the menu. Select the menu command, and the link address of the picture is copied.
The above is all the contents of the article "how to use vbs to add right-click menus for copying image addresses in IE browsers". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.