It is currently April 20th, 2024, 3:56 pm

Java program to add enigma launchers.

Tips and Tricks from the Rainmeter Community
l3uddy789
Posts: 5
Joined: May 28th, 2010, 8:42 pm

Java program to add enigma launchers.

Post by l3uddy789 »

If you are like myself you like engima's launchers but feel 5 is a very limiting number (regularity principle.) Anyway I started doing some copy pasting to make myself more and decided I was to lazy so I wrote a java program to do this for me and thought I would share it.

Here is the code:

Code: Select all

// [0] = name
// [1] = location
// [2] = subName


import java.io.*;

public class ELA{
	public static void main(String args[]){
		//replace location with coresponding file location from local host. 
		//NOTE: the final '/' is needed. 
		String location = "C://Users/ian/Documents/Rainmeter/Skins/Enigma/Taskbar/Launcher/";
		
		//----------------------------------------------------------------------------------------
		// create new directory and file.
		//----------------------------------------------------------------------------------------
		
		//new directory
		File directory = new File(
			location + args[0]);
		try{
			directory.mkdir();
		}
		catch(SecurityException e){
			System.err.println("well shit.");
		}
		
		//new file
		File newFile = new File(location + args[0] + "/" + args[0] + ".ini");
			
		try{
			newFile.createNewFile();
		}
		
		catch(IOException e){
			System.err.println("file didn't get created");
		}
		
		//----------------------------------------------------------------------------------------
		// write to new file.
		//----------------------------------------------------------------------------------------
		PrintWriter out = null;
		try{
			out = new PrintWriter(new FileWriter(location + args[0] + "/" + args[0] + ".ini"));
				
			out.println("[Variables]");
			out.println("@include=#@#User\\Options.inc");
			out.println("@include2=#@#Styles\\#Stylesheet#\\Options.inc");
			out.println("@include3=#@#Styles\\#Stylesheet#\\TaskbarCommon.inc");
			out.println("@include4=#ROOTCONFIGPATH#Taskbar\\Launcher\\Launcher.inc");
			out.println("App=" + args[0]);
			out.println("AppPath=" + args[1]);
			out.println("AppPathHandle=");
			out.println("AppLabel=" + args[2]);
			out.println("AppIcon =");
			out.println("Variant=Mini");
			out.flush();
			out.close();
		}
		catch(IOException e){
			System.out.println("error writing to file");
		}
	}
}
and here is what I did with it:
http://imgur.com/FNaMMDS

simple instructions:
1. compile java file.
2. run java file with specific params. An example of this would be if I wanted to create the launcher on the top left of my imgur link. I would type in:
java ELA Chrome "file location for chome.exe" APP
first param is the name of the launcher, second is where it is located in memory, third is the sub name thing for it.
3. You need to prompt rainmeter to refresh its known skins. (either refresh in manager or restart rainmeter)


P.S. If someone wants to convert this to an executable that would be awesome I acctually don't know how to do this and don't feel like looking it up.
x_magnumse_x
Posts: 21
Joined: May 23rd, 2013, 2:52 pm

Re: Java program to add enigma launchers.

Post by x_magnumse_x »

That looks really nice man!

I've also started working on something like that, except didn't think of using Java - not familiar with that.. guess i'm not that nerdy :(