Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 help and support Forum Windows 8 Forum Vista Tutorials

Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Vista Forums > Tutorials

Vista - Internet Explorer - Open Selected Text into Notepad

Comment
 

Internet Explorer - Open Selected Text into Notepad

How to Open Selected Text from Internet Explorer into Notepad
Published by sidney1st
06-11-2008
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.





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
Published by
sidney1st's Avatar
Member
Join Date: Apr 2008
Location: Paris
Posts: 970
sidney1st has a reputation beyond reputesidney1st has a reputation beyond reputesidney1st has a reputation beyond reputesidney1st has a reputation beyond reputesidney1st has a reputation beyond reputesidney1st has a reputation beyond reputesidney1st has a reputation beyond reputesidney1st has a reputation beyond reputesidney1st has a reputation beyond reputesidney1st has a reputation beyond reputesidney1st has a reputation beyond reputesidney1st has a reputation beyond reputesidney1st has a reputation beyond repute

Tutorial Tools

Applies to
All Vista Versions
64 Bit & 32 Bit

04-08-2010  
Ghis1964


Vista Home Premium 32bit
 
 

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 System SpecsSystem Spec
04-08-2010  
MilesAhead


Vista Home Premium 64 bit SP1
 
 

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

Quote: Originally Posted by Ghis1964 View Post
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 System SpecsSystem Spec
04-08-2010  
Ghis1964


Vista Home Premium 32bit
 
 

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 System SpecsSystem Spec
04-08-2010  
MilesAhead


Vista Home Premium 64 bit SP1
 
 

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

Quote: Originally Posted by Ghis1964 View Post
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 System SpecsSystem Spec
Comment

 Internet Explorer - Open Selected Text into Notepad problems?



Tutorial Tools


Similar topics to: Internet Explorer - Open Selected Text into Notepad
Tutorial Category
It says my internet is connected but when I open Internet Explorer it doesn't work! Browsers & Mail
Internet explorer text box typing problem Vista General
How to Open Selected Registry Address from Internet Explorer into Regedit Tutorials
When viewing text files on the web, make them open with notepad Vista General
Explorer: want to open file in Notepad with F4 Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50