Copy link to clipboard
Copied
Is there a way to copy clipboard content to the description of the form field i have selected?
Copy link to clipboard
Copied
Clarifying. I'm also trying to set multiple properties and assign a shortcut to the script.
Ideally, I'd like to copy the content I want for the form field description, select the form field, activate the script which would then:
Copy link to clipboard
Copied
Hello @LynxKx,
Give the below code a try...
function Main() {
function GetClipboard(){
var clipboard;
if(File.fs == "Macintosh"){
var script = 'tell application "Finder"\nset clip to the clipboard\nend tell\nreturn clip';
clipboard = app.doScript (script,ScriptLanguage.APPLESCRIPT_LANGUAGE);
} else {
var script = 'Set objHTML = CreateObject("htmlfile")\r'+
'returnValue = objHTML.ParentWindow.ClipboardData.GetData("text")';
clipboard = app.doScript(script,ScriptLanguage.VISUAL_BASIC);
}
return clipboard;
}
myDescriptionText = GetClipboard();
try {
mySelObject.properties = {
appliedFont: "Arial",
fontSize: 0,
fontStyle: "Regular",
description: myDescriptionText,
multiline: true,
scrollable: false
}} catch(e) {}
}
if (app.selection.length == 0) {
alert("Error!\nNothing is selected.");
}
else if (app.selection.length > 1) {
alert("Error!\nThere's more than one object selected.");
}
else if (app.selection.length == 1 && app.selection[0].hasOwnProperty("baseline")) {
alert("Error!\nThere's some text selected.");
}
else if (app.selection[0].constructor.name != "TextBox") {
alert("Error!\nNo form field Text Box is selected.")
}
mySelObject = app.selection[0];
Main();
Regards,
Mike
Copy link to clipboard
Copied
Beautiful!
Copy link to clipboard
Copied
a couple things:
Copy link to clipboard
Copied
Hello,
I've ran the script on a few different files and I haven't seen any lag time or delay in its execution.
I don't have a way to actually text to see if it will work on a PC or not but it should.
Could you post one of the documents that your'e seeing the lagging issue for troubleshooting purposes?
Regards,
Mike