Beenden
  • Globale Community
    • Sprache:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티

Scripting: Colour value (RGB) to clipboard?

Community-Einsteiger ,
Jan 19, 2021 Jan 19, 2021

Hi guys,

 

Is there an script option to copy a colour value of a selected object to clipboard? I have stumbled upon some script snippets all accross the Interweb; however, I wasn't able to find a full, working .jsx file to use as script. The best I have found was an option of exporting the swatches' values to a txt file, nevertheless, this didn't work for me as there were plenty of colour in the file and I'd lose track of which is which.

 

Simply selecting the object, running the script and ending up with three numbers in the Clipboard would be sufficient.

 

Thanks!

THEMEN
Skripterstellung
366
Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines

correct answers 1 richtige Antwort

Ratgeber , Jan 19, 2021 Jan 19, 2021

 

if (app.selection.length != 1 || app.selection[0].typename != "PathItem") {
    alert( "Select one pathItem." );
} else if (app.selection[0].fillColor.typename != "RGBColor") {
    alert( "Color is not RGB." ); 
} else {
    var AR = app.activeDocument.artboards[0].artboardRect;
    var rect1 = app.activeDocument.pathItems.rectangle(0, AR[2]-100, 100, 100);
    var R = Math.round(app.selection[0].fillColor.red), 
    G = Math.round(app.selection[0].fillColor.green), 
    B = Math.round(app.sele
...
Übersetzen
Adobe
Ratgeber ,
Jan 19, 2021 Jan 19, 2021

 

if (app.selection.length != 1 || app.selection[0].typename != "PathItem") {
    alert( "Select one pathItem." );
} else if (app.selection[0].fillColor.typename != "RGBColor") {
    alert( "Color is not RGB." ); 
} else {
    var AR = app.activeDocument.artboards[0].artboardRect;
    var rect1 = app.activeDocument.pathItems.rectangle(0, AR[2]-100, 100, 100);
    var R = Math.round(app.selection[0].fillColor.red), 
    G = Math.round(app.selection[0].fillColor.green), 
    B = Math.round(app.selection[0].fillColor.blue);
    var text0 = app.activeDocument.textFrames.areaText(rect1);
    text0.contents = R + ", " +  G + ", " + B;
    app.selection = null;
    app.activeDocument.pageItems[0].selected = true;
    app.cut();
};

 

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines
Community-Einsteiger ,
Jan 20, 2021 Jan 20, 2021
AKTUELL

Thanks so much, @femkeblanco !

Übersetzen
Melden
Community-Richtlinien
Seien Sie freundlich und respektvoll, geben Sie die ursprüngliche Quelle der Inhalte an und suchen Sie vor dem Absenden Ihres Beitrags nach Duplikaten. Weitere Informationen
community guidelines