• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit Search
0

Script to copy SVG code from selected object

New Here ,
Aug 29, 2022 Aug 29, 2022

Copy link to clipboard

Copied

Hi all,

I am trying to create my first Illustrator Script and it seems that I need some help.

Lucas6620_2-1661838259063.png

When selecting and copying two objects (like in the image above) and pasting them into a text editor, the following SVG code will be pasted:

<?xml version="1.0" encoding="UTF-8"?>
<svg id="Layer_1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24">
<defs><style>.cls-1{fill:#ebebeb;}</style></defs>
<rect class="cls-1" width="24" height="24"/>
<path d="M16.71,9.29c.2,.2,.29,.45,.29,.71s-.1,.51-.29,.71-.45,.29-.71,.29-.51-.1-.71-.29l-2.29-2.29v9.59c0,.55-.45,1-1,1s-1-.45-1-1V8.41l-2.29,2.29c-.39,.39-1.02,.39-1.41,0-.2-.2-.29-.45-.29-.71s.1-.51,.29-.71l4-4c.2-.2,.45-.29,.71-.29s.51,.1,.71,.29l4,4Z"/>
</svg>

 

The script that I am trying to create should help me manipulating the SVG code so that only the text inside the quotes of <path d=""/> will be pasted.

 

The result should look like this:

M16.71,9.29c.2,.2,.29,.45,.29,.71s-.1,.51-.29,.71-.45,.29-.71,.29-.51-.1-.71-.29l-2.29-2.29v9.59c0,.55-.45,1-1,1s-1-.45-1-1V8.41l-2.29,2.29c-.39,.39-1.02,.39-1.41,0-.2-.2-.29-.45-.29-.71s.1-.51,.29-.71l4-4c.2-.2,.45-.29,.71-.29s.51,.1,.71,.29l4,4Z

 

Does anyone have an idea how to solve this?

 

Thanks a lot! 

TOPICS
Scripting

Views

23

Translate

Translate

Report

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
no replies

Have something to add?

Join the conversation