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

Script to copy SVG code from selected objects

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_1-1661839645549.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:

Lucas6620_3-1661839661769.png

(The path is shortened)

 

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

 

The result should look like this:

Lucas6620_4-1661839751276.png

 

Does anyone have an idea how to solve this?

 

Thanks a lot! 

TOPICS
Scripting

Views

86

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
Adobe
LEGEND ,
Aug 30, 2022 Aug 30, 2022

Copy link to clipboard

Copied

Could probably something as simple as a regex.match("d=\""*"\"") applied before copying to the clipboard as a filter. Just a suggestion and you need to look it up. I'm not that fluent at regex and of course if there are multiple objects/ multiple lines of code you would need to expand it further.

 

Mylenium

Votes

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
New Here ,
Aug 30, 2022 Aug 30, 2022

Copy link to clipboard

Copied

LATEST

Thank you for the tip.

But do you have an idea how I can read the content of my clipboard?

Votes

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