1

I am trying to run a Javascript file locally, which is supposed to create a CSS image sprite using ImageMagick. It's part of the OpenID selector JS component: http://code.google.com/p/openid-selector/

The generate-sprite.js (http://code.google.com/p/openid-selector/source/browse/trunk/generate-sprite.js?r=140) file is supposed to create the image sprite automatically. However, whenever I run it in IE (the local version of the file, of course), I get the error SCRIPT5009: 'WScript' is undefined on line 19, character 1.

I have of course installed ImageMagick and updated the location in the js file. IE9 is letting the ActiveX execute.

Since I'm not familiar with WScript, I am completely lost. Googling didn't help, since this seems to be a very generic error.

Can somebody help diagnose this error please?

Donnie Thomas
  • 3,888
  • 8
  • 47
  • 70

1 Answers1

3

When you say you're "running" the JavaScript file locally, are you using Windows? If so, and double-clicking or typing the filename from the command line doesn't work, try:

wscript generate-sprite.js

...which explicitly invokes wscript.exe.

If you're not using Windows, you can't use that script — it relies on both Windows and Microsoft's JScript (which the wscript.exe program invokes).

T.J. Crowder
  • 1,031,962
  • 187
  • 1,923
  • 1,875
  • I was including the file in an HTML file and opening that in the browser. I tried wscript generate-sprite.js, but now I'm getting an error on a different line: Line 35, char 1: Expected Identifier, string or number. :( – Donnie Thomas Dec 13 '10 at 18:04
  • The error was on the line 'eval(s)'. I figured it was trying to execute the contents of the other js file, and failing. Instead I just copied the contents into the same file and it worked! – Donnie Thomas Dec 13 '10 at 18:12