Photoshop スクリプトでクリップボードにコピーする方法。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
function copyTextToClipboard(text) { var folderForTempFiles = Folder.temp.fsName; // create a new textfile and put the text into it var clipTxtFile =new File(folderForTempFiles + "/ClipBoard.txt"); clipTxtFile.open('w'); clipTxtFile.write(text); clipTxtFile.close(); // use the clip.exe to copy the contents of the textfile to the windows clipboard var clipBatFile =new File(folderForTempFiles + "/ClipBoard.bat"); clipBatFile.open('w'); clipBatFile.writeln("cat \"" + folderForTempFiles + "/ClipBoard.txt\"|clip"); clipBatFile.close(); clipBatFile.execute(); } |
Photoshop CS6 (v13.1)の場合は下記スクリプトでクリップボードにアクセスできます。
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
function copyTextToClipboardCS6(text){ var txd=app.charIDToTypeID('TxtD'); var kttc = app.stringIDToTypeID( "textToClipboard" ); var ad = new ActionDescriptor(); ad.putString(txd,text); // executeAction( kttc, ad, DialogModes.NO ); } function copyTextToClipboardCS6(txt){ const keyTextData = app.charIDToTypeID('TxtD'); const ktextToClipboardStr = app.stringIDToTypeID( "textToClipboard" ); var textStrDesc = new ActionDescriptor(); textStrDesc.putString( keyTextData, txt ); executeAction( ktextToClipboardStr, textStrDesc, DialogModes.NO ); } |
Reference:
//forums.adobe.com/thread/799232
//stackoverflow.com/questions/4066108/photoshop-jsx-how-do-i-copy-arbitrary-text-to-the-clipboard
コメントを残す