Results 1 to 5 of 5

Thread: IE Context Menu

  1. #1

    Thread Starter
    Addicted Member Xdream's Avatar
    Join Date
    Mar 2001
    Location
    Switzerland
    Posts
    194

    Smile IE Context Menu

    Hi

    I'm trying to implement my application to the internet explorer context menu. I managed to show the title of my application in the menu but there is no action using these registry keys:

    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\&MyAppl\
    (Standard)=P:\Work\vb\MyAppl.exe
    contexts=1

    What I'd like to do: As you click the menu entry, my application will get the url of the current page (or frame) like the way you can read it out in the properties.

    Can anybody help me or give me some hints?

    thanks and regards
    Xdream

  2. #2
    Hyperactive Member ashay's Avatar
    Join Date
    Feb 2002
    Location
    Mumbai,India
    Posts
    278
    hi,

    I had done the same thing using a script file.U need to have the same entry in d registry as u hv done.

    Change the path of ur exe to the script file :

    HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\&MyAppl\
    (Standard)= C:\\MyApp\\myscript.htm
    contexts=1

    I hv used "\\" for the paths.

    myscript.htm :
    VB Code:
    1. <script language="JavaScript">
    2.  
    3.   var parentwin = external.menuArguments;//get a handle to the external window
    4.   var doc = parentwin.document;
    5.   var sel = doc.selection;//This is the selection done by the mouse.....the highlighted part
    6.   var rng = sel.createRange();
    7.   var str = new String(rng.text);
    8.  
    9.   var strLanguage="Any+Language"
    10.   var strMode1="and"
    11.   var strSortBy1="Date_Newest"
    12.   var strSearchSize="25"
    13.   var winOpen
    14.  
    15.    winOpen="http://mysearch.com/?template=mysearch%2Fsearch.txt&action=search&first=0&SearchString="+ str +"&Language=" + strLanguage + "&mode=" + strMode1 + "&SortBy=" + strSortBy1 + "&SearchSize=" + strSearchSize + "&x=19&y=6"
    16.  
    17.      
    18.   if(external.menuArguments.event.shiftKey)//If shift key is pressed then open in new window or else in the same window
    19.     parentwin.open(winOpen);
    20.   else
    21.     parentwin.navigate(winOpen);
    22. </script>


    This works for me.No idea bout hw to send the url to the exe.Maybe its d same way.

    Or u can just try out by using "\\" in ur path of the exe(just a guess!!)


    regds,
    ashay
    "If you should die before me, ask if you could bring a friend."
    - Stone Temple Pilots

  3. #3

    Thread Starter
    Addicted Member Xdream's Avatar
    Join Date
    Mar 2001
    Location
    Switzerland
    Posts
    194
    hi ashay

    thanks alot, it's working this way to get the location. I've changed the script:
    Code:
    <script language="JavaScript">
      var parentwin = external.menuArguments;//get a handle to the external window
      alert(parentwin.location);
    </script>
    maybe you can use a vbscript as well, in this case it would be easy to send the url to an exe...
    does anyone know how to get the url with vbscript?

    regards, xdream

  4. #4

    Thread Starter
    Addicted Member Xdream's Avatar
    Join Date
    Mar 2001
    Location
    Switzerland
    Posts
    194
    ... and the same thing using vbscript

    Code:
    <script language="VBScript"> 
    	Dim strUrl, FileObject, MyLogFile, WshShell
    
    	Set strUrl = external.menuArguments.document.location
    	
    	Set FileObject = CreateObject("Scripting.FileSystemObject")
    	Set MyLogFile = FileObject.OpenTextFile("C:\test.txt", 8, True)
    	
    	MyLogFile.writeline strUrl
    	
    	Set WshShell=CreateObject("Wscript.Shell")
    	WshShell.Run "P:\Work\vb\pathChanger\pathMan.exe" & " " & strUrl
    </script>
    know, I just need to prepare my application to handle the url...

  5. #5
    Hyperactive Member DovyWeiss's Avatar
    Join Date
    Feb 2002
    Location
    Miami Beach, FL
    Posts
    366
    Try adding into the JavaScript:

    location = "C:\MyApp\MyApp.exe " & external.menuArguments.location

    That will probably launch your app with the URL as the command-line paramater.

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