RichardU Posted July 10, 2004 Report Share Posted July 10, 2004 Here is the challenge: I have an HTML file on my computer's hard drive and I'm looking at it with Internet Explorer. I want to click on a hyperlink, and instead of having it take me to somewhere on the web, I want it to activate a macro, preferably without leaving the page I'm looking at. Any way to do this? Thanks, Richard Quote Link to comment Share on other sites More sharing options...
Jim Korenthal Posted July 10, 2004 Report Share Posted July 10, 2004 Richard, there's an easy solution which will "almost" solve your problem. If you define a macro's activation to be on a left mouse click anywhere on the screen (look at Properties, it's easy to do this), it will trap all your left clicks without passing them on to the underlying program. (Note that this is different from "Wait Left Mouse Click," which does pass the click on.) This will let you do what you want and then decide whether to pass the mouse click through (by issuing a Mouse Left Button Click command). You'd have to be careful that this macro only wakes up when you want it to -- you should be able to control that with the Macro Enable and Macro Disable commands. Of course this solution doesn't guarantee that you're actually clicking on a hyperlink. If you needed that guarantee you could probably get it with some clever "get pixel color" programming, but this would take a bit of work. Good luck, Jim P.S. It occurred to me right after I posted this that if you restrict the macro to your browser's window (using the Scope tab) and instead of activating mouse clicks across the whole screen, you did it "within window" and specified just the text area of your browser, you'd be catching hyperlinks and very few clicks for other reasons with no additional programming. Depending on what your macro does, this might even obviate the need for the Macro Enable/Disable kludge. Quote Link to comment Share on other sites More sharing options...
joe Posted July 11, 2004 Report Share Posted July 11, 2004 Hello Richard! Here is another partial answer because I do not know enough about html (please ... no wisecracks about my web site). It seems that what you are really asking is "how can I run an executable program, any executable program, by simply clicking on a link in an html document?" If someone in the group can answer that question ... and provide a simple example, then the problem might be solved, because ... you can create either a link (Macros | Place on Desktop) or an external playable macro (File | Export | Export as Playable Macro) out of a macro from the Macro Explorer pane. If you click on an .mxe file (a playable macro), Windows uses the Macro Express file association to run it. Quote Link to comment Share on other sites More sharing options...
RichardU Posted July 12, 2004 Author Report Share Posted July 12, 2004 Joe: Good idea. Does anyone know how to use a hyperlink to execute an .exe file? Quote Link to comment Share on other sites More sharing options...
RichardU Posted July 12, 2004 Author Report Share Posted July 12, 2004 I found the answer in another forum. Works with Internet Explorer. Cool. Richard put this in a notepad file and save it in the same directory as your html page as "openexe.js" function ShellExJ(filename) { var objShell = new ActiveXObject("Shell.Application"); objShell.ShellExecute(filename, "", "", "open", 1); } put this in the <head> tag in the html doc <script language="jscript" src="openexe.js"></script> finally, put this code where ever you want the links (this example would open frontpage xp) <a target="_self" href="java script:ShellExJ('c:\\Program Files\\Microsoft Office\\Office10\\frontpg.exe')">Frontpage</a> Quote Link to comment Share on other sites More sharing options...
floyd Posted July 12, 2004 Report Share Posted July 12, 2004 Richard, This is great. I am very anxious to try it out! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.