By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,296 Members | 1,469 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,296 IT Pros & Developers. It's quick & easy.

launching applications with javascript

P: n/a
Hello. I've written a page for an intranet that gives the user the
option of launching a Word or PowerPoint document.

The code I used to force the hyperlink to launch the application
rather than open the file in a browser is:

<script language="JavaScript">
function startPowerPoint(strFile)
{
var myApp = new ActiveXObject("PowerPoint.Application");
if (myApp != null)
{
myApp.Visible = true;
myApp.Presentations.Open(strFile);
}
}
</script>

Then the link is:
javascript:startPowerPoint('http://servername/PowerPoint_files/template.PPT')

This works perfectly if PowerPoint is not running. However, if
PowerPoint is already open, it launches subsequent files underneath
the intranet page.

Is there a way to modify the script so that, whenever it launches a
PowerPoint document, it switches focus to that document?

Thanks,
David
Jul 23 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a


David wrote:

The code I used to force the hyperlink to launch the application
rather than open the file in a browser is:

<script language="JavaScript">
function startPowerPoint(strFile)
{
var myApp = new ActiveXObject("PowerPoint.Application");
if (myApp != null)
{
myApp.Visible = true;
myApp.Presentations.Open(strFile);
}
}
</script>

Then the link is:
javascript:startPowerPoint('http://servername/PowerPoint_files/template.PPT')

This works perfectly if PowerPoint is not running. However, if
PowerPoint is already open, it launches subsequent files underneath
the intranet page.

Is there a way to modify the script so that, whenever it launches a
PowerPoint document, it switches focus to that document?


We rarely have people scripting PowerPoint here, if you have PowerPoint
then you should look into its documentation, it should document the
object model, the documentation is geared towards VBA but of course the
object model and the property and method names are the same when you use
JScript to script PowerPoint. Look up whether the PowerPoint.Application
object has a propery or method to bring it to the front. Looking into
the object model here I guess that
myApp.Activate();
brings the application window to the front but I haven't tested that.
I am sure people in a powerpoint group know more about that.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.