0

I have this JavaScript function which is working in all the machines I tried except the one that is running on Vista. I am calling this function onload. what do you think is wrong with this one.

function isePad() {
    var epad;
    epad = window.document.esCapture1.ConnectedDevice;

    if (!epad) {
        alert('Sorry epad either is not Connected or/and drivers are not installed');
    }
}
David Basarab
  • 72,212
  • 42
  • 129
  • 156
acadia
  • 2,301
  • 10
  • 40
  • 57
  • 2
    What does “not working” mean? Does it throw an error or is the result not as expected? – Gumbo Jan 20 '10 at 17:55
  • What interpreter are you using? Windows Script Host? – jball Jan 20 '10 at 17:56
  • 1
    What is ePad? A device? A product? A platform? Can you give a link? – Pekka Jan 20 '10 at 17:58
  • @pekka: http://www.epadlink.com/ @Gumbo: It throws Javascript object expected error @jball: Windows Script Host – acadia Jan 20 '10 at 18:02
  • 1
    Well, maybe the ePad is either not connected or/and the drivers are not installed? :) Have you made sure they are? Do your user rights give you access to the device? Can you try running the script as Administrator? From what I hear, Vista is really a PITA rights-wise sometimes. How, when and where do you load this ePad thing? `window.document.esCapture1` is hardly available in WSH by default, it it? Is your question anserwed by jball's answer below (is it a syntax question) or is your device not working? – Pekka Jan 20 '10 at 18:08

1 Answers1

1

esCapture1 probably does not exist - You should check for it first:

function isePad() { 
    var epad; 
    if(window.document.esCapture1){
        epad = window.document.esCapture1.ConnectedDevice; 
    }

    if (!epad) { 
        alert('Sorry epad either is not Connected or/and drivers are not installed'); 
    } 
} 
jball
  • 24,791
  • 9
  • 70
  • 92