Internet Explorer - Open Selected Text into Notepad

How to Open Selected Text from Internet Explorer into Notepad

Adding a function in the context menu is quite easy.

You noticed that many apps offer some context menu facilities, to do so they mainly use an activex/addon installed with their program.

An IE context menu item is usually linked to a htm/html file wich includes scripts, links to activex, etc... and use a personalized dll.

In fact we have to write a script, embed it or name it as a htm file and ask the registry to write an entry in the context menu which on click links to the htm file.

Due to UAC, the htm file will ask to open a VBS file which will do the job.
A prompt will ask you if you accept to run the script.
Personally i place the htm file in the common files folder where i created a folder named "Registry" just to remember it better, but it could be anywhere.
The VBS file should be in %windir% so that it can be called from anywhere.
Then, the last thing to do is to add the registry key which will modifiy the IE context menu.


The added context menu items are in:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\



OPTION ONE:
1/ We will start by the htm file:

We want to add in the context menu an item which when clicked opens Notepad with a selected text writen in.
So we have to make a script which copy the selected text into the clipboard.


Code:
<SCRIPT>
var CheckForSelection = window.external.menuArguments.document.selection.createRange().text;
window.clipboardData.setData("Text",CheckForSelection);
</SCRIPT>

Well, now we have to run a vbs script which will do the rest of the job.
We will call this VBScript OpenNP, we will make it after this step.


Code:
<SCRIPT LANGUAGE="VBScript">
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "%windir%\OpenNP.vbs",1,False
Set WshShell = Nothing
</SCRIPT>

We just copy these 2 scripts above in notepad and save as OpenNP.htm in: C:\Program Files\Common Files\Registry


2/ It is time now to make the script which will open Notepad and paste the selected text in it.

Code:
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run "%Windir%\notepad.exe", 1
WScript.Sleep 1000
WshShell.SendKeys "^v"
Set WshShell = Nothing

Of course, for notepad the "%windir%" is useless, i just put it to make it more understandable. Writing "notepad" is enough, therefore if you prefer to use wordpad, just replace "%Windir%\notepad.exe" by "wordpad" and instead of naming the registry key "Open In Notepad", name it "Open In Wordpad".
And if you prefer WinWord or Uedit, do as above but in some cases you will have to increase the sleep time (value in ms).

We just copy these lines above in notepad and save as OpenNP.vbs in: C:\Windows


3/ To finish, we write the new key in the registry.

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\

Create a new key named: Open In Notepad and give as default value: File://C:\Program Files\Common Files\Registry\OpenNP.htm

Close Regedit, open IE and test. (select a text, right click and "Open in Notepad").


OPTION TWO:
If you are as lazy as i am, all files are in the attached zip file.



View attachment 4464 < Click To Download
  • Extract OpenNP.htm to C:\Program Files\Common Files\Registry
  • Extract OpenNP.vbs to C:\Windows
  • Run OpeninNP.reg to write the context menu key in the registry
 

Attachments

  • thumb_Notepad.png
    thumb_Notepad.png
    13.7 KB · Views: 341
Last edited by a moderator:
Re: How to Open Selected Text from Internet Explorer into Notepad

not bad!

How about "open picture in" (paint.exe or any I choose)?

I know this post is old, but this is the closer I've come to what I look for.

btw; the one you made for notepad works great (I changed it to notepad++ instead)

Peace
Ghis
 

My Computer

Re: How to Open Selected Text from Internet Explorer into Notepad

not bad!

How about "open picture in" (paint.exe or any I choose)?

I know this post is old, but this is the closer I've come to what I look for.

btw; the one you made for notepad works great (I changed it to notepad++ instead)

Peace
Ghis

Funny, I never noticed this tutorial. I have a free program I wrote some months ago that may do what you want. Instead of using the Registry and a context menu, it sits in the tray and waits for you to press a hotkey. It uses Selected Text, or clipboard text... but it also has a facility to open an image url with the default program for that file type. It's called Selector and you can download it here:

Hotkeys

It has a ListBox you load by dragging either program files or shortcuts to programs onto it. I wrote it mainly to open a different browser with the selected address without using plugins, but it's useful for opening any single program with a single command line parameter.

edit: btw the default hotkey is Shift NumberPadDiv, but there's a command in the Tray Menu to change it.
 

My Computer

System One

  • Manufacturer/Model
    HP Pavilion m9515y
    CPU
    Phenom X4 9850
    Memory
    8 GB
    Graphics card(s)
    Some Radeon Cheapie with 512 MB Ram
    Monitor(s) Displays
    CRT
    Screen Resolution
    1280x1024
    Hard Drives
    750 GB SATA 3G 2 SIIG Superspeed docks w/WD Caviar Black Sata II or III
Re: How to Open Selected Text from Internet Explorer into Notepad

thx,

I'll definitely try it. I never thought I'd get a reply from this so soon.
I have tried a bunch of croppers hoping I could get some pieces of their codes or dlls in order to make something with. But they don't even work as they are in the first place.
I don't need croppers; I already have snipping tool and gimp.
What I was looking in the first place (for some mouths now) is an app or a firefox plugin so I could just copy and send the clipboard to any app I would config to.

Peace
 

My Computer

Re: How to Open Selected Text from Internet Explorer into Notepad

thx,

I'll definitely try it. I never thought I'd get a reply from this so soon.
I have tried a bunch of croppers hoping I could get some pieces of their codes or dlls in order to make something with. But they don't even work as they are in the first place.
I don't need croppers; I already have snipping tool and gimp.
What I was looking in the first place (for some mouths now) is an app or a firefox plugin so I could just copy and send the clipboard to any app I would config to.

Peace

Hope it works for you. My utility only uses text type clipboard contents, not graphics. The way to use it with an image is to use Copy Image Location to get the url of the image in the clipboard. The readme should have enough detail to get you going.
 

My Computer

System One

  • Manufacturer/Model
    HP Pavilion m9515y
    CPU
    Phenom X4 9850
    Memory
    8 GB
    Graphics card(s)
    Some Radeon Cheapie with 512 MB Ram
    Monitor(s) Displays
    CRT
    Screen Resolution
    1280x1024
    Hard Drives
    750 GB SATA 3G 2 SIIG Superspeed docks w/WD Caviar Black Sata II or III
Back
Top