How do I add UE32 to IE's context menu?

How do I add UE32 to IE's context menu?

5
NewbieNewbie
5

    Apr 29, 2006#1

    Hi all,

    I want to add UltraEdit-32 to the Internet Explorer context menu, without changing the default app for the "View Source" command.
    Some applications, like MS Excel, put external commands there, so this should be possible, no?

    I'm not talking about files in Windows Explorer, rather the context menu you get when right clicking an open webpage in IE.
    (please see screenshot at end of post)

    I've already added UE32 to:
    HKEY_CLASSES_ROOT\.htm\OpenWithList
    So it shows up in the Internet Options control panel applet under "Programs/HTML Editor".
    It also works fine in the list of editors in the IE toolbar button.

    Since the toolbar isn't always available (active desktop, vb scripted pages, pop-ups, etc.),
    I'd like to have the choice of either the default "View Source" editor or UE32.

    I've been trying to hack this registry entry:
    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt
    ...but I'm getting the syntax wrong. My "Open in UltraEdit-32" shows up in the context menu, but nothing happens when I try it.

    I also haven't found any useful info via Google. Does anyone here know how to accomplish this?

    Thanks!

    40
    Basic UserBasic User
    40

      Re: How do I add UE32 to IE's context menu?

      Apr 30, 2006#2

      what value you put in the registry entry you created under
      HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt

      all the entries in \MenuExt seem to point to a file with a .htm or .html extension, and these files contain some js or vbs script which is executed when you click the right click menu entry.
      You may examine the .htm files in other entries. For those starting with res:\\ , just paste the res: url in IE and then view source.

      So I guess you should create such htm file. The script inside should locate the current file in the cache and then launch UE with the cache path as a parameter. But I have no idea how to locate the file in the cache.
      You may get its http URL, but don't know if you can launch UE with a http argument (and even if possible, this will probably result in a new download of the file).
      Have to go now and can't test this, post if you have some progress.

      5
      NewbieNewbie
      5

        Re: How do I add UE32 to IE's context menu?

        Apr 30, 2006#3

        yeah, that's pretty much what I've been discovering, too. thanks :)

        40
        Basic UserBasic User
        40

          Re: How do I add UE32 to IE's context menu?

          May 01, 2006#4

          well I played a bit and managed to capture the source of the current page in a variable and then save it to a file.
          But can't find a way to start UE and open this file in it, in fact I can't start any executable from the .htm file I created.

          5
          NewbieNewbie
          5

            Re: How do I add UE32 to IE's context menu?

            May 01, 2006#5

            Sounds like you've made some progress, which is more than I can say :P

            I'm usually proficient with hacking the registry, but scripting is a bit beyond me. I hope you'll be able to accomplish this, you'll prob win some UE converts at the MSDN forums if you do. They've been stumped by this, as well, and would really like to figure it out.

            Please keep me posted here if you find a solution, k? Good Luck!

            40
            Basic UserBasic User
            40

              Re: How do I add UE32 to IE's context menu?

              May 01, 2006#6

              here is my htm file.

              the JS script reads the source to a variable. The VB script saves that variable to a file.
              If needed, you may make the js or vbs to put source in the clipboard instead of saving it.
              But I'm not able to launch an .exe
              For this purpose I guess I should use a wscript.shell object but this returns an error.
              Maybe the existing file may send keystrokes to the OS to trigger some global shortcut which will launch UE with a parameter to read a file or with a macro parameter to read the clipboard.

              Code: Select all

              <script language="JavaScript" defer>
              
              	var aa; aa='';
              	var windowElem = window.external.menuArguments;
              	if ( windowElem != null )
              	{
              	
              		//without these useless 2 lines script sometimes fails
              		var srcElem = external.menuArguments.event.srcElement;
              		alert("srcElem="+srcElem.outerHTML);
              
              		var docElem = external.menuArguments.document;
              		
              		 for (var i=0;i < 2; i++){
                          if (docElem.all(i).tagName == 'HTML'){
                              aa=docElem.all(i).outerHTML //aa var keeps source of the file
              								//alert(aa);
              					}
              			}
              		
              		if(aa.length > 5){saveOpen(aa)};
              				
              		}
              </script>
              
              <script language="VBScript">
              
              	function saveOpen(inp)	
              	
              			msgbox inp
              			
              			outpFile = "C:\tmp\qwerty.htm"
              			uePath = "C:\Program Files\UltraEdit\uedit32.exe"
              			
              			dim fs,objTextStream
              			Set fs = CreateObject("Scripting.FileSystemObject")
              			Set objTextStream = fs.CreateTextFile(outpFile, True)
              			objTextStream.Write (inp) 
              	  	objTextStream.Close
              	  	Set objTextStream = Nothing
              	    Set fs = Nothing
              			
              			'command to execute
              			cmdstr = Chr(34) & uePath & Chr(34) & " " & Chr(34) & outpFile & Chr(34) 
              			MsgBox "cmdstr = " & cmdstr
              		
              	end function
              	
              </script>	
              	
              

              5
              NewbieNewbie
              5

                Re: How do I add UE32 to IE's context menu?

                May 04, 2006#7

                This is getting a little over my head (sorry), but is there anything I can do here to help make this work?

                  Re: How do I add UE32 to IE's context menu?

                  May 12, 2006#8

                  I just found the solution. There is a Maxthon plugin that actually works on webpages displayed in almost any browser, incuding IE and the Windows Active Desktop.

                  It's the "ViewPartialSource! Menu Extension" and it adds a context menu item to view the html of the currently selected text, image, etc. However, if nothing is selected it will open the *entire* page in the editor of your choice (default is Notepad.) I had no trouble at all setting it to use UE32.

                  It's freeware and is available here:
                  http://tara.maxthon.com/index.php?act=view&id=268

                  So now, I can use UE32 when I need to do a quick edit without launching all the graphics, etc. in my default editor. Sweet!