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

Javascript: get object text from CPM.js

Community Beginner ,
Jun 21, 2023 Jun 21, 2023

Hi I would like to fetch the text data from an object on any slide e.g cp.model.data.Slide5832.si[6].

I see can see some of the relevant objects properties like position etc, however the actual text data of the layer is only avaliable in CPM.js as a html string.

Does anyone know what function could be used to extract the html string from CPM.js by using the object reference in cp.model.data?

 

Would be a massive help to my project if anyone knows how to do this!

Thanks Jorgen

TOPICS
Advanced
190
Translate
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
Advisor ,
Jun 23, 2023 Jun 23, 2023

I will make an attempt here.

I admit I have been struggling to fully grasp what you are trying to locate but the impression I get is that you're trying to grab the text from an object on the screen - like a smart shape perhaps...?

If that is the case - you will need to know the name of the object on screen. In my example below I have a smart shape with the name of "box".

You will need to hit the canvas element of that object so add a  'c'  to the end of the object name.  so   boxc  in this case.

Then you can find the text of that object.

 

cp.model.data.boxc.accstr

Stagprime_0-1687523449944.png

 

Am I reading the request correctly?

Translate
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 ,
Jun 28, 2023 Jun 28, 2023

Hello!... I need to know the path in which I can get the CPM.js file. 
I need to change some string, because it is in English and I need it in Spanish, when I publish an HTML5 project.

Please help me!!!

Translate
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
Community Expert ,
Jun 28, 2023 Jun 28, 2023
LATEST

You find it in the published folder under assets\js.

Translate
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
Resources
Help resources