Results 1 to 3 of 3

Thread: [IE Addin] Copy HIGHLIGHT-Tagged Code From Fourms

  1. #1

    Thread Starter
    PoorPoster iPrank's Avatar
    Join Date
    Oct 2005
    Location
    In a black hole
    Posts
    2,728

    [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 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:
    • As described above


    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.
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by iPrank; May 19th, 2007 at 02:33 AM.
    Usefull VBF Threads/Posts I Found . My flickr page .
    "I love being married. It's so great to find that one special person you want to annoy for the rest of your life." - Rita Rudner


  2. #2
    Lively Member
    Join Date
    Mar 2007
    Posts
    88

    Re: [IE Addin] Copy HIGHLIGHT-Tagged Code From Fourms

    Can u please do it for Mozilla Firefox

  3. #3
    VB6, XHTML & CSS hobbyist Merri's Avatar
    Join Date
    Oct 2002
    Location
    Finland
    Posts
    6,654

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width