Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

Path2Clipboard - Quick made in 71 minutes

• ♠️​ ♦️ ♣️ ​♥️ •
Joined
Mar 25, 2012
Messages
909
Reaction score
464
Just programmed a little tool in the school via Teamviewer on my PC at home in Visual Studio (.NET 4.5, should work with 3.5, too). I won't count on a big nice design, since it's a quick ride. Just shared it, cuz I think this might be useful to most of you, lol.

שเ๒єtгเ๒є - Path2Clipboard - Quick made in 71 minutes - RaGEZONE Forums

Yes, it does exactly what you think it does, lol.


- Create a new Visual Studio console application project and add a reference to System.Windows.Forms (for the clipboard function).
- Paste this in the Program.cs:
PHP:
class Program
	{
		[STAThread]
		static void Main(string[] args)
		{
			string[] paramList = Environment.GetCommandLineArgs();
			if (paramList != null && paramList.Length > 1 && paramList[1].Length > 1)
			{
				string param = paramList[1].Trim('"').Trim();
				if (param.Length == 2 && (param[0] == '-' || param[0] == '/'))
				{
					string name = paramList.Length > 2 && paramList[2] != null && paramList[2].Length > 0 ? paramList[2] : "Copy path to clipboard";
					switch (param[1].ToString().ToLower()[0])
					{
						case 'i':
							RegistryKey rki = Registry.LocalMachine.CreateSubKey("SOFTWARE").CreateSubKey("Classes").CreateSubKey("*").CreateSubKey("shell");
							try { rki.DeleteSubKeyTree("Path2Clipboard"); }
							catch { }
							rki = rki.CreateSubKey("Path2Clipboard");
							rki.SetValue("", name, RegistryValueKind.String);
							rki = rki.CreateSubKey("command");
							rki.SetValue("", "\"" + System.Reflection.Assembly.GetExecutingAssembly().Location + "\" \"%1\"", RegistryValueKind.String);
							Console.WriteLine("Successfull registered.");
							break;
						case 'u':
							RegistryKey rku = Registry.LocalMachine.OpenSubKey("SOFTWARE", true).OpenSubKey("Classes", true).OpenSubKey("*", true).OpenSubKey("shell", true);
							try
							{
								rku.DeleteSubKeyTree("Path2Clipboard");
								Console.WriteLine("Successfull unregistered.");
							}
							catch { }
							break;
					}
				}
				else if (param.Length > 2)
				{
					Clipboard.SetText(param);
				}
			}
		}
	}


- Compile and place anywhere
- Open CMD as admin and navigate to the directory of the tool

Use the following commands to register / unregister the application:
Code:
Register with "Copy path to clipboard" entry name: Path2Clipboard.exe -i
Register with custom entry name: Path2Clipboard.exe -i "Copy path"
Unregister again: Path2Clipboard.exe -u


Have fun lol
 
Last edited:
• ♠️​ ♦️ ♣️ ​♥️ •
Joined
Mar 25, 2012
Messages
909
Reaction score
464
Pro tip: Shift + Right Click a file will give you the same option.
שเ๒єtгเ๒є - Path2Clipboard - Quick made in 71 minutes - RaGEZONE Forums

Hahaha, never knew this thanks. Good that this program did not cost me time to create lol. Haha.
I just dislike it stores the path with double quotes, since I do not need them everywhere and removing them is more complicated than adding them.
 
Last edited:
Back
Top