Copy link to clipboard
Copied
Is it possible to retrieve whats in the clipboard through a script?
If so how?
Copy link to clipboard
Copied
Hi
try below:
app.paste();
Ten
Copy link to clipboard
Copied
You didn't say what language of script… AppleScript & Shell can certainly tell you whats on the clipboard… I would expect the same to be true with VB on the PC side… ExtendScript has no direct access to the clipboard data… With AI ten's solution would be the only way… I would wrap this in a try/catch just in case AI don't like the data type…
Copy link to clipboard
Copied
I'm using javascript on Windows and I'm new to scripting illustrator.
What I want is to get whats in the clipboard into an array. Can app.paste(); be used for that?
Also is there a way of getting "paste in place" instead of just "paste" as I need the clipboard content to be pasted in the same position they where before cutting them out?
I found this line of code on a javascript site but I guess thats for web coding only?
window.clipboardData.getData('Text');
Also, how do I "wrap it in a try"?
Sorry for beeing noobish.
Copy link to clipboard
Copied
Personally I would only use app.copy() & app.paste() if I was wanting data to either take data in or out of AI for use in another app… For all internal use use duplicate to location… I script I just try avoid the clipboard as its always subject to change… Your snippet can NOT be used with Adobe's version of JavaScript…
Copy link to clipboard
Copied
Ok, I see. I think I'll have to do it another way then. Thanks anyway.
Copy link to clipboard
Copied
Hi Muppet Mark, can you tell me a way of putting a string onto the clipboard - I need this to work inside a dialog launched from Adobe's JavaScript
Copy link to clipboard
Copied
‌if we knew a bit more about what you are trying to achieve we could give better answers.
if your just wanting text then store in a variable.
or you can, in essence store the link to an object in a variable.
or as mark said duplicate the objects.
so many ways to store info that does not rely or change the current contents of the clipboard.
let us know what you are doing and we can point you in the right direction.
give us your step by step process and we can give you methods to do each step.
we all started as noobs to this at some point.
most of what I know I learnt here.
Copy link to clipboard
Copied
Hi Qwertyfly
I am writing a dialog using Adobe Javascript which opens up on clicking on an object in my PDF.
This dialog lists some data about the object using list_box
I need a mechanism of allowing the user to select an item from that list and copy it to the clipboard
I can get the selected text from the list box but don't know how to put it on the clipboard.
Copy link to clipboard
Copied
WWhat are you doing with this info once it is in the clipboard.
is it for use in illustrator. Another Adobe program. Or a different program. If so which program.‌
Copy link to clipboard
Copied
it could be any program like a wordpad, notepad or even excel
Copy link to clipboard
Copied
did you try? app.copy()
Copy link to clipboard
Copied
Yas CarlosCanto I tried app.copy but it doesn't work
Copy link to clipboard
Copied
if its going in to a New text file or csv.
then very easy to create a new file, add the data, and even open it once done.
if your set on using the clipboard use:
app.copy()
as Carlos stated.
or even:
app.executeMenuCommand('copy');
but I think app.copy() is prob the better option...
Copy link to clipboard
Copied
Qwertfly I tried both the options but they don't work
I think the problem is that I have no way of setting the text to the clipboard, because there is no selection as such that is there with the app, both these options don't copy anything
Copy link to clipboard
Copied
you're right, it doesn't work, refreshing does, I just tried and it works
app.copy();
app.redraw();
Copy link to clipboard
Copied
For me app.copy is not recognized. Here is the error in the debugger:
Acrobat JavaScript Debugger Functions Version 11.0
Acrobat EScript Built-in Functions Version 11.0
Acrobat SOAP 11.0
app.copy is not a function
Copy link to clipboard
Copied
you're missing parenthesis, aside from that, you should be using the ESTK for developing and debugging
edit:
are you trying to script Illustrator? or Acrobat?
Copy link to clipboard
Copied
I'm writing a dialog that will come up inside a PDF file, the debugger is the default debugger available with Acrobat XI Pro version
Here is the code snippet I'm using
"butn":function(dialog){
app.alert("Copy");
var elements=dialog.store()["ls10"];
for(var i in elements) {
if ( elements > 0 ) {
var mystr=i.toString();
app.alert(mystr);
app.copy();
app.redraw();
}
}
},
description:{
name:"Attributes",
elements:[
{
type:"view",
align_children:"align_center",
elements:[
{
type:"view",
width:263,height:160,char_width:8,char_height:8,
align_children:"align_left",
alignment:"align_center",
elements:[
{
type:"static_text",
item_id:"sta9",
name:" Name Value ",
width:240,height:12,
},
{
type:"list_box",
item_id:"ls10",
PopupEdit: true,
SpinEdit: true,
width:250,height:126,char_width:8,char_height:8,
},
]
},
{type:"ok",},
{
type:"button",
item_id:"butn",
name: "Copy"
},
]
},
]
}
};
Copy link to clipboard
Copied
Copy link to clipboard
Copied
thanks CarlosCanto