Adding a Menu Item to the Tools Menu of MSIE to Run WB Script
Keywords: MSIE Explorer Tools Menu Run Winbatch WBT
Question:
I want to run a .wbt script from IE, the idea is to add a menu item to the tools menu of IE that runs the script. I don't know if running the wbt script directly will work, maybe running it as an exe or a vbs script that runs the wbt script (is there a better way?)Everything is explained here:
http://msdn.microsoft.com/workshop/browser/ext/tutorials/menu.aspThe 1st step is to create a GUID, i think a know how to do this:;CREATE GUID (S1) ole32=strcat(dirwindows(1),"ole32.dll") ;get handle hguid=binaryalloc(100) dllcall(ole32,long:"CoCreateGuid",lpbinary:hguid) binaryeodset(hguid,100) ;convert to string guidbuf=binaryalloc(100) dllcall(ole32,long:"StringFromGUID2",lpbinary:hguid,lpbinary:guidbuf,long:100) binaryeodset(guidbuf,100) ;convert to ansi BinaryConvert(guidbuf, 3, 0, 0, 0) guid=binarypeekstr(guidbuf,0,100) message("",guid)Following steps involve to write to the registry, i have no experience with these functions, attached is my attempt maybe just to demostrate my ignorance, of course i did not run it.Which is the right way to do it? Also i would like to know how to remove everything, menu item, registry.
Answer:
You can do it with the registry functions:;Add a menu item to MSIE tools menu that runs a wbt script ;change menutext/statustext and wbt script with yours ;CREATE GUID (S1) ole32=strcat(dirwindows(1),"ole32.dll") ;get handle hguid=binaryalloc(100) dllcall(ole32,long:"CoCreateGuid",lpbinary:hguid) binaryeodset(hguid,100) ;convert to string guidbuf=binaryalloc(100) dllcall(ole32,long:"StringFromGUID2",lpbinary:hguid,lpbinary:guidbuf,long:100) binaryeodset(guidbuf,100) ;convert to ansi BinaryConvert(guidbuf, 3, 0, 0, 0) guid=binarypeekstr(guidbuf,0,100) clipput(guid) binaryfree(hguid) binaryfree(guidbuf) message("",guid) ;REGISTRY ;S2 Create key guidkey=RegCreateKey(@REGMACHINE, strcat("Software\Microsoft\Internet Explorer\Extensions\",guid)) ;S4 Set interface indentifier value RegSetValue(guidkey, "[CLSID]" , "{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}") ;S5 Set menu text RegSetValue(guidkey, "[MenuText]" , "Yourmenutext") ;S6 Set status bar text RegSetValue(guidkey, "[MenuStatusBar]" , "Yourstatustext") ;Associate wb script (or executable..) RegSetValue(guidkey, "[Exec]" , "c:\yourscript.wbt") regclosekey(guidkey) message("","done") exitTo remove everything you need the GUID you created, in the example is copied to the clipboard. Or if you lost it just use regedit to browse for the key you created and delete it.Knowing the GUID:
RegDeleteKey(@REGMACHINE, strcat("Software\Microsoft\Internet Explorer\Extensions\",guid))See the microsoft link below for details:http://msdn.microsoft.com/workshop/browser/ext/tutorials/menu.asp