6 Replies Latest reply on Dec 6, 2015 8:27 PM by JJMack

    clip.exe

    boo radley 2013 Level 3

      hello everyone

       

      I have a script which copies the active layer name to the clipboard. Initially, I was running this script under WindowsXP 32-bit, with a 32-bit version of Photoshop CS6 (but- it may have been the 64-bit version of CS6, I can't remember exactly).

       

      However, now that I've upgraded to Windows7 64-bit and Photoshop CC2014 64-bit, this script seems to not be working anymore. Although I'm not 100% sure. It seems to have worked intermittantly, but lately I can't get it going at all.

       

      Under XP, I would download the file named "Clip.exe" from the internet and paste it into my system32 folder.

       

      It's my understanding that with Windows7 64-bit, this file is already included by default in the system 32 folder, even though I can't seem to locate it there. So I've tried pasting it in there anyways, but it won't let me as it says the file is already in that folder, even though I can't find it.

       

      Nonetheless- can anyone confirm that the following script should work in Photoshop CC2014 under Windows7 64 bit? If so, do I need to paste "Clip.exe" into the system32 folder or does it already exist in there with Windows7 by default?

       

      app.system( "echo "   + activeDocument.activeLayer.name + " | CLIP");
      
      
        • 1. Re: clip.exe
          boo radley 2013 Level 3

          I'd like to provide a quick update to this and also a possible bug if I may:

           

          It seems that Clip.exe comes with Windows7 in the System32 folder by default, so there's no need to obtain the file from elsewhere and paste it in there.

           

          That said, there seems to be a bug which breaks the Clip.exe's functionality. Here's what to do to:

           

          In the Color Panel, click on the drop-down menu (in the upper-right hand corner of the panel) and select the item named "Copy Color's Hex Code". This should now copy the foreground color's code to the clipboard

           

          The problem is, once you've done this, any other script which utilizes "Clip.exe" will not work.  I don't know why, but doing this seems to break that functionality.

           

          To repair it, you need to do the following:

           

          1. click on the color swatch icon in the tools panel, and wait for the "Color Picker (Foreground Color)" window to open. When it opens, manually highlight the color's code (the 6-digit field beside the # sign) and right-click/copy it to the clipboard. Then, hit OK to return to Photoshop.

           

          At this point - any scripts which need "Clip.exe" will work again.

           

           

          Are there any seasoned scripting veterans here who can figure out exactly what's happening here?

          • 2. Re: clip.exe
            JJMack Most Valuable Participant

            I'm on Windows 10 there is a clip.exe included. However I do not understand why you would need to use and external module to do what you seem to want to do.  Why can you not simply made as select like select all and use copy or copy merge to put what you want in the clipboard.

             

            Here I used flatten  to merge layerd first.

            flatten(); //handle layered images// flatten active document incase its layered.
            backFile.selection.selectAll();
            backFile.selection.copy();//copy resized image into clipboard
            backFile.close(SaveOptions.DONOTSAVECHANGES); //close image without saving changes

             

            Capture.jpg

            • 3. Re: clip.exe
              boo radley 2013 Level 3

              I'm not trying to copy the layer contents to the clipboard, I'm trying to copy the layer *name* to the clipboard. For this you need to use "clip.exe". As stated, there seems to be a bug which breaks that funcionality and I can't figure out why. 

              • 4. Re: clip.exe
                JJMack Most Valuable Participant

                OK I see you want the layer name in the clipboard as text. Echo Piped to clip. f it does and that is not working for you. Perhaps you can tell us why you need the layers name in the clipboard as text.  What are you are you doing in the script the needs that text in the clipboard. Perhaps Photoshop start a tread for the Application.system command and the script keep running and the part that needs the text from the clipboard executes before the text get into the clipboard.  You could try putting a do nothing loop in the script after  using Echo . to slow the script down to give echo piped the clip.exe time to finish.

                 

                I wrote a Photoshop Script that uses and external command to do something create what the script needs.  I needed to put a delay in and a pause to get the script to work reliably.

                 

                StartPgm(path,program,options,pbmName);                                             // Create eps file
                app.refresh();                                                                      // slow down Photoshop with a refresh
                for (var i=0;i<100000;i++) { if (!testeps.exists) break; }                          // wait a short time before forcing a pause
                if (!testeps.exists) {alert('File "' + testeps + '" was not cteated yet'); }        // force a pause
                if (!testeps.exists) {alert('File "' + testeps + '" was not cteated'); return;}     // failed to create the eps file
                • 5. Re: clip.exe
                  boo radley 2013 Level 3

                  using Clip.exe in a script works. But it stops working as soon as you go into the Color Panel's drop-down menu and select "Copy Color's Hex Code". Once you do that, any other script that calls on Clip.exe won't work. I think it's a bug.

                   

                  To repair it, you need to go into the "Color Picker (Foreground Color)" window and manually highlight the 6-digit hex code, right-click and copy it. Once you do that, then any script calling on Clip.exe will work again. It's very odd but at least for me, that's what's happening.

                  • 6. Re: clip.exe
                    JJMack Most Valuable Participant

                    If it is a bug is it a windows bug or a Photoshop bug. In either case if you need the script you need to work around the problem. If it is indeed a bug in Photoshop Adobe may choose not to fix it. If the bug in in Windows you should report the bug to Microsoft.  If you feel its a bug in Photoshop you should report the bug to Adobe using their feedback site Photoshop Family Customer Community

                     

                    There are bugs in Adobe Photoshop you need to work around some have been the for many years.