Răsfoiți Sursa

added vbs stub to suppress the flashing cmd window on load of the iZpl
file

LH 7 ani în urmă
părinte
comite
7eba56a43c

+ 11 - 0
iZpl/src/dist/bin/silent.vbs

@@ -0,0 +1,11 @@
+If WScript.Arguments.Count >= 1 Then
+    ReDim arr(WScript.Arguments.Count-1)
+    For i = 0 To WScript.Arguments.Count-1
+        Arg = WScript.Arguments(i)
+        If InStr(Arg, " ") > 0 Then Arg = """" & Arg & """"
+      arr(i) = Arg
+    Next
+
+    RunCmd = Join(arr)
+    CreateObject("Wscript.Shell").Run RunCmd, 0, True
+End If

+ 69 - 68
iZpl/src/main/java/de/nplusc/izc/iZpl/Utils/Utilities.java

@@ -1,68 +1,69 @@
-/*
- * Copyright (C) 2015 iZc
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package de.nplusc.izc.iZpl.Utils;
-
-import de.nplusc.izc.iZpl.API.IZPLApi;
-import java.awt.Desktop;
-import java.io.File;
-import java.io.FileWriter;
-import java.io.IOException;
-
-/**
- *
- * @author iZc <nplusc.de>
- */
-public class Utilities
-{
-    public static void registerFileExtensions()
-    {
-        String extensionPath = (IZPLApi.APPDIR+File.separator+"bin"+File.separator+"iZpl.bat").replace("\\", "\\\\");
-        String iconMain=(IZPLApi.APPDIR+File.separator+"res"+File.separator+"izpl.ico,0").replace("\\", "\\\\");
-        String iconResume=(IZPLApi.APPDIR+File.separator+"res"+File.separator+"izplresume.ico,0").replace("\\", "\\\\");     
-        String regPatternPlayList="Windows Registry Editor Version 5.00\n" +
-        "\n" +
-        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.playlist\\shell\\open\\command]\n" +
-        "@=\"cmd.exe /D /C "+extensionPath+" --file \\\"%1\\\"\"\n" +
-        "[HKEY_CURRENT_USER\\Software\\Classes\\.izpl]\n" +
-        "@=\"izplaylist.playlist\"\n"+
-        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.playlist\\DefaultIcon]\n" +
-        "@=\""+iconMain+"\"\n" +
-        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.resumefile\\shell\\open\\command]\n" +
-        "@=\"cmd.exe /D /C "+extensionPath+" --resume \\\"%1\\\"\"\n" +
-        "[HKEY_CURRENT_USER\\Software\\Classes\\.izcont]\n" +
-        "@=\"izplaylist.resumefile\"\n"+
-        "[HKEY_CURRENT_USER\\Software\\Classes\\.izcontinue]\n" +
-        "@=\"izplaylist.resumefile\"\n"+
-        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.resumefile\\DefaultIcon]\n" +  // nicht die Software\\Classes\\ kkomponente im pfad vergesse.!!!
-        "@=\""+iconResume+"\"";
-        //regedit /fickDich
-        
-        try
-        {
-            new File(IZPLApi.APPDIR+File.separator+"res").mkdirs();
-            FileWriter fw = new FileWriter(new File(IZPLApi.APPDIR+File.separator+"res"+File.separator+"fileexts.reg"));
-            fw.write(regPatternPlayList);
-            fw.flush();
-            fw.close();
-            Desktop.getDesktop().open(new File(IZPLApi.APPDIR+File.separator+"res"+File.separator+"fileexts.reg"));
-        }
-        catch (IOException ex)
-        {
-            ex.printStackTrace();
-        }
-    }
-}
+/*
+ * Copyright (C) 2015 iZc
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package de.nplusc.izc.iZpl.Utils;
+
+import de.nplusc.izc.iZpl.API.IZPLApi;
+import java.awt.Desktop;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+
+/**
+ *
+ * @author iZc <nplusc.de>
+ */
+public class Utilities
+{
+    public static void registerFileExtensions()
+    {
+        String launcherPath = (IZPLApi.APPDIR+File.separator+"bin"+File.separator+"iZpl.bat").replace("\\", "\\\\");
+        String silencerStubPath = (IZPLApi.APPDIR+File.separator+"bin"+File.separator+"silent.vbs").replace("\\", "\\\\");
+        String iconMain=(IZPLApi.APPDIR+File.separator+"res"+File.separator+"izpl.ico,0").replace("\\", "\\\\");
+        String iconResume=(IZPLApi.APPDIR+File.separator+"res"+File.separator+"izplresume.ico,0").replace("\\", "\\\\");     
+        String regPatternPlayList="Windows Registry Editor Version 5.00\n" +
+        "\n" +
+        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.playlist\\shell\\open\\command]\n" +
+        "@=\"wscript "+silencerStubPath+" cmd.exe /D /C "+launcherPath+" --file \\\"%1\\\"\"\n" +
+        "[HKEY_CURRENT_USER\\Software\\Classes\\.izpl]\n" +
+        "@=\"izplaylist.playlist\"\n"+
+        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.playlist\\DefaultIcon]\n" +
+        "@=\""+iconMain+"\"\n" +
+        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.resumefile\\shell\\open\\command]\n" +
+        "@=\"wscript "+silencerStubPath+" cmd.exe /D /C "+launcherPath+" --resume \\\"%1\\\"\"\n" +
+        "[HKEY_CURRENT_USER\\Software\\Classes\\.izcont]\n" +
+        "@=\"izplaylist.resumefile\"\n"+
+        "[HKEY_CURRENT_USER\\Software\\Classes\\.izcontinue]\n" +
+        "@=\"izplaylist.resumefile\"\n"+
+        "[HKEY_CURRENT_USER\\Software\\Classes\\izplaylist.resumefile\\DefaultIcon]\n" +  // nicht die Software\\Classes\\ kkomponente im pfad vergesse.!!!
+        "@=\""+iconResume+"\"";
+        //regedit /fickDich
+        
+        try
+        {
+            new File(IZPLApi.APPDIR+File.separator+"res").mkdirs();
+            FileWriter fw = new FileWriter(new File(IZPLApi.APPDIR+File.separator+"res"+File.separator+"fileexts.reg"));
+            fw.write(regPatternPlayList);
+            fw.flush();
+            fw.close();
+            Desktop.getDesktop().open(new File(IZPLApi.APPDIR+File.separator+"res"+File.separator+"fileexts.reg"));
+        }
+        catch (IOException ex)
+        {
+            ex.printStackTrace();
+        }
+    }
+}