Path2Clipboard - Quick made in 71 minutes

Results 1 to 4 of 4
  1. #1
    • ♠️​ ♦️ ♣️ ​♥️ • שเ๒єtгเ๒є is offline
    MemberRank
    Mar 2012 Join Date
    917Posts

    Path2Clipboard - Quick made in 71 minutes

    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.


    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 Code:
    class Program
        
    {
            [
    STAThread]
            static 
    void Main(string[] args)
            {
                
    string[] paramList Environment.GetCommandLineArgs();
                if (
    paramList != null && paramList.Length && paramList[1].Length 1)
                {
                    
    string param paramList[1].Trim('"').Trim();
                    if (
    param.Length == && (param[0] == '-' || param[0] == '/'))
                    {
                        
    string name paramList.Length && paramList[2] != null && paramList[2].Length 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(""nameRegistryValueKind.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 by שเ๒єtгเ๒є; 21-01-14 at 06:42 PM.


  2. #2

    Re: Path2Clipboard - Quick made in 71 minutes

    Pro tip: Shift + Right Click a file will give you the same option.
    Spoiler:


    Last edited by Puck Ultimate; 21-01-14 at 02:08 PM.

  3. #3
    • ♠️​ ♦️ ♣️ ​♥️ • שเ๒єtгเ๒є is offline
    MemberRank
    Mar 2012 Join Date
    917Posts

    Re: Path2Clipboard - Quick made in 71 minutes

    Quote Originally Posted by Puck Ultimate View Post
    Pro tip: Shift + Right Click a file will give you the same option.
    Spoiler:


    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 by שเ๒єtгเ๒є; 21-01-14 at 06:36 PM.

  4. #4
    Developer iGalaxy is offline
    MemberRank
    Jul 2013 Join Date
    C:/xampp/htdocsLocation
    488Posts

    Re: Path2Clipboard - Quick made in 71 minutes

    Although it exists, I'd still like to say, well done!



Advertisement