Sendkeys problem with Vista

Discussion in 'Windows Vista General Discussion' started by lcwakeman, Feb 17, 2007.

  1. lcwakeman

    lcwakeman Guest

    I am pretty sure that this is a problem with Vista and not I.E. but I have
    bni idea where in the Vista forums to post this. The following code works in
    XP with IE 6 and IE 7:

    function playFile(player, file)
    {
    var WshShell = new ActiveXObject("WScript.Shell");
    if (WshShell.AppActivate("Windows Media Player")) {
    WshShell.SendKeys('%FO');
    WshShell.SendKeys(file);
    WshShell.SendKeys('{ENTER}');
    } else {
    WshShell.Run('"'+player+'" "'+file+'"');
    }
    }

    It is called by passing in the fully specified (C:\...) location of the
    WIndows Media Player and an mp3 file that I want it to play. When the Media
    Player isn't running, it is started and the file plays. If the Media Player
    is running, it can't open the file. After some examination, the File Open
    Dialog box is dropping the first characters of the file name (as in the C)
    and
    of course, WMP can't open ":/...". ANy Ideas?

    I am actually using another program that doesn't work by associating a file
    type. It always starts a new instance of the program. I tried it with WMP
    to see if the issue was with the program I use and it fails the same way.
     
    lcwakeman, Feb 17, 2007
    #1
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.