Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Possible to copy string to Windows clipboard?

New Here ,
Jan 20, 2009 Jan 20, 2009
I'm trying to write a short script to add a context menu item that copies the selected item's URI to the Windows clipboard so I can paste it into an email.

The following code shows the string in an alert box:

if (app.document.selections.length==1)
{
var myPath = decodeURI( app.document.selections[0].path);
alert(myPath);
} else if (app.document.selections.length==0 || app.document.selections.length>1)
{
alert("Please select single file or folder");
}

I thought this might be ok but since I can't highlight the text on the alert box it doesn't help much. Is there any way to copy a string from the script into the Windows clipboard?
TOPICS
Scripting
540
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Jan 20, 2009 Jan 20, 2009
LATEST
I've just come up with a temporary solution. Replacing the alert with a prompt box with the path as the default text means I can copy it.

Replace:
alert(myPath);

with:
prompt("",myPath);

It's not as quick as I'd like since I have to right-click the text, select copy then close the prompt box. But it's the best solution I've got so far.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines