2 Attachment(s)
[IE Addin] Copy HIGHLIGHT-Tagged Code From Fourms
(Inspired by MartinLiss' utility)
Utility: Copy HIGHLIGHT-tagged code from Internet Explorer context menu
Title: VBCode
Description: As you may be aware when you try to copy and then paste VB code which has been displayed in the forums using [Highlight=VB] tags, the result is a single run-on line. A partial solution to that problem is to paste the code into WordPad (not NotePad) and then copy again from there, but while that gives separate lines, all indentation is lost.
This utility provides a complete solution for IE users.
This utility adds a new menuitem, "Copy VBCode" in Internet Explorer right-click context menu. When you select a HIGHLIGHT code block and right-click, this menuitem will appear. Clicking on the "Copy VBCode" menu will remove the numbering while maintaining line integrity and indenting. You then use Ctrl_V as normal to paste into a VB program.
For similar code in an standatd exe see this.
For similar code in an Add-In see this.
Code: This utility uses simple VBScript (inside CopyVBCode.html) and a Reg file (CopyVBCode.reg). Both files are available in attatched zip archive. NO COMPILATION NEEDED and there is NO DEPENDENCY (except IE :p ofcourse).
Installation:
1. Extract both files.
2. Now open the CopyVBCode.reg file in NOTEPAD.
3. Now replace the C:\\CopyVBCode.html text with the path where you extracted the html file. Remember to add double backslashes for path separator. So, if you have extracted the html file in D:\MyFolder\MySubFolder\, your regfile will look like:
Code:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\Copy &VBCode]
@="D:\\MyFolder\\MySubFolder\\CopyVBCode.html"
"Contexts"=dword:00000010
4. Save the reg file and doubleclick the file to import into registry.
5. Instalation complete.
Test Page: Click Here
Feature list:
Known Problems:
- Can't copy if multiple [HIGHLIGHT] block is selected.
- Will not work on [CODE] block.
Screen-shots: The following shows the "Copy VBCode" menu highlighted in IE context menu
Author Name: iPrank
Text stolen from: MartinLiss
Idea stolen from: Static
Any feedback welcome. :)
Re: [IE Addin] Copy HIGHLIGHT-Tagged Code From Fourms
Can u please do it for Mozilla Firefox
Re: [IE Addin] Copy HIGHLIGHT-Tagged Code From Fourms
Start making a new bookmark.
Name it VBcode.
Paste the following as URL:
Code:
javascript:var%20s=new%20Array();s=document.getSelection().split("#\r\n");var%20j=s.join('');document.innerHTML+='<textarea%20id="a"%20style="position:fixed;left:0;top:0;width:100%;height:100%"%20onmouseover="this.select()"%20onkeypress="history.go(-1)">'+j+'</textarea>'
Now when you select a text and click that button you can then push Ctrl + C to copy the text. It then returns back to the previous page and you have the text in the clipboard.
Accessing clipboard via JavaScript is disabled by default for security, this is why doing this kind of a trick.