Loading ContentPlacerObject

Explorer ,
Jun 29, 2022 Jun 29, 2022

Copy link to clipboard

Copied

Hi.

 

I am trying to load the ContentPlacerObject using the load() method.

The load method takes a pageItem as an input.

 

Question

Is it possible to create a pageItem (a textFrame) and load it to the ContentPlacerObject without outputting the pageItem to the document.

 

Have a nice day 🙂

TOPICS
Scripting

Views

82

Likes

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 Community Professional ,
Jun 29, 2022 Jun 29, 2022

Copy link to clipboard

Copied

Hi @rasmussvanejensen, I'm not knowledgeable about this question, but I guess that you cannot create a pageItem that isn't on a page. What is your reason why you don't want to create it on a page? I'm assuming it is because loading to the ContentPlacerObject is the end of the script and you won't have a chance to clean up. Hmmm. Perhaps you could define an event handler that did the cleanup (eg. closing a hidden temp document without saving)? I'm not knowledgeable about that proecss either. Sorry I'm not much help, but maybe you have something to explore.

- Mark

Likes

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
Explorer ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

Hi @m1b.

Thanks for your reply 🙂

 

I'll quickly sum up the script:

The script creates a textframe containing an ID as content.The user will then place the textframe manualy using the mouse. The textframe and ID is used to quickly create crossreferences.

 

I have a working version, where I output the textframe to the current page and then use app.cut() to move it to the clipboard for the user to paste out.

 

I have found two issues I would like to improve:

1: The textframe is outputted to the upper left corner of the page, which can cause the screen to "jump" to the corner if zoomed in.

2: It would be nice to place the textframe in the Content placer tool or otherwise load it to the mouse to improve UX.

 

I was hoping to solve both problems in one go if I could skip placing the textframe before adding it to the clipboard or content placer.


Maybe the solution is to place the textframe inside the "view" of the screen to fix the "jump".

Likes

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 Community Professional ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

It's an interesting project. You can set the view position using @Laubender's answer to this question but I couldn't see how to read the current view position. I have asked my own question to see if anyone knows how to do it.

- Mark

Likes

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
Explorer ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

Hi Mark.

Thank you for your help! I'll dive into the posts 🙂

Likes

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 Community Professional ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

@rasmussvanejensen said:

"2: It would be nice to place the textframe in the Content placer tool or otherwise load it to the mouse to improve UX."

 

You can do this be exporting the text frame to an IDMS snippet file and load it to the place gun.

When this is done remove the snippet file.

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

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
Explorer ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

Hi @Laubender.

Thank you for your reply.

I will have a look into that approach!

Thank you 🙂

Likes

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 Community Professional ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

Here very simple ExtendScript code that shows this:

var folderToSave = Folder( "~/Desktop" );
var uniqueString = Date.now().toString();
var tempIdmsFile = File( folderToSave +"/"+ uniqueString +".idms" );

// Text frame selected:
var itemToExport = app.selection[0];

itemToExport.exportFile( ExportFormat.INDESIGN_SNIPPET , tempIdmsFile );

var placeGun = app.documents[0].placeGuns;
placeGun.loadPlaceGun( tempIdmsFile );

tempIdmsFile.remove();

 

Regards,
Uwe Laubender
( Adobe Community Professional )

Likes

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
Explorer ,
Jun 30, 2022 Jun 30, 2022

Copy link to clipboard

Copied

LATEST

Thank you! That was a great example!

Likes

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