Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Launching apps using hyperlinks to open files 1

Status
Not open for further replies.

gtrllg

Technical User
Nov 15, 2007
2
US
Hi,

The code fragment below works for MS WORD.

However, I'd like to be able to launch other editors from a hyperlink with the target file to open as well.

Any suggestions?

Can it be done from within the hyperlink or do I need a Javascript?


<a href="javascript:startWord('c:/test/test.c')">

<script language='JavaScript'>
function startWord(strFile)
{
var myApp = new ActiveXObject('WordPad.Application');
if (myApp != null)
{
myApp.Visible = true;
myApp.Documents.Open(strFile);
}
}
</script>
 
[1]
>var myApp = new ActiveXObject('WordPad.Application');
[tt]var myApp = new ActiveXObject('[red]Word[/red].Application');[/tt]
[2]
>However, I'd like to be able to launch other editors from a hyperlink with the target file to open as well.
You can. But not all utilities are implemented with automation interface, so the appearence would not be the same as ms word does. For notepad.exe or even archaic edit.com, you can do this "within hyperlink" (see [3]).

[tt] <a href="javascript:void(new ActiveXObject('wscript.shell').run('notepad.exe c:\\test\\test.c'))">open it</a>[/tt]

[3]>Can it be done from within the hyperlink or do I need a Javascript?
The example of [2] may be what you mean "within" the hyperlink, but it is still using jscript as the gluing language. (You can use jscript, you can use vbscript, you can even use perl, you can even use php client-side as long as it is supported. There is nothing sacro-saint javascript in this concern. There are many non-sense cliché repetitors making a technical matter as if it is a dirty business.)

[4] This is ie-application only, not for the consumption of general audience.
 
This is awesome.

I just got an email from someone who said that this could not be done.

Thanks so much!!!!!!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top