home *** CD-ROM | disk | FTP | other *** search
- var gWorkshop = WScript.CreateObject("Workshop.Automation");
- var netcardPath = GetNetCardPath();
-
- if (netcardPath != "")
- {
- var argList = WScript.Arguments;
- if (argList.length > 0)
- {
- var FSO = WScript.CreateObject("Scripting.FileSystemObject");
- var WSHShell = WScript.CreateObject("WScript.Shell");
- var kJPEGFormat = 2;
- var kBitsPerPixel = 24;
- var kCompressionFactor = 100;
- for (i = 0; i < argList.length; i++)
- {
- var tempFile = argList(i);
- var bConvert = !IsValidFileExtension(FSO.GetExtensionName(tempFile));
- if (bConvert)
- // Save in temporary jpg file, 24 bits/pixel, 100% compression, no thumbnail
- tempFile = gWorkshop.CreateTempFile(argList(i), kJPEGFormat, kBitsPerPixel, kCompressionFactor, false);
-
- WSHShell.Run(netcardPath + " " + tempFile, 1, true);
-
- // Delete the temporary file
- if (bConvert && FSO.FileExists(tempFile))
- FSO.DeleteFile(tempFile, true);
- }
- WSHShell = "";
- FSO = "";
- }
- else
- {
- if (gWorkshop.DoCommand(20003,0) == 0)
- gWorkshop.RunCommand(netcardPath);
- }
-
- }
- else
- WScript.Echo("Can't find the program NetCard.exe. \n\nMake sure that it is installed correctly and try again.");
-
-
- gWorkshop = "";
-
- function GetNetCardPath()
- {
- var gWSHShell = WScript.CreateObject("WScript.Shell");
- var netcardPath = gWSHShell.RegRead("HKCU\\Software\\PictureWorks\\NetCard\\Location\\Path");
- gWSHShell = "";
- return netcardPath;
- }
-
-
- function IsValidFileExtension(extension)
- {
- extension = extension.toLowerCase();
-
- return ( extension == "jpg" ||
- extension == "jpeg" ||
- extension == "jpe" ||
- extension == "bmp" ||
- extension == "avi")
- }
-