Skip to main content
Participant
April 1, 2024
Question

PlaceGun does not have reference to idms textframe

  • April 1, 2024
  • 1 reply
  • 1755 views

Hi,

I'm trying to place a textframe from an idms file into an indesign document. The actual loadPlaceGun() operation seems to work fine as I'm able to paste the textframe on the page. However, I also want to have a reference to that textframe. I was trying to accomplish this by using 

placeGun.pageItems.everyItem().getElements(), but it doesn't return any elements. I find this odd because I'm using the same method when inserting images and it works fine, so I'm not sure what the issue is. Any ideas would be appreciated!

 

 

Thanks
This topic has been closed for replies.

1 reply

Robert at ID-Tasker
Legend
April 1, 2024

Workaround:

  1. Add an empty page at the end of the document.
  2. Place your IDMS file there.
  3. Get a reference to the 1st - and only - object on that page.

 

Phil 815
Inspiring
April 2, 2024

Hi Robert,

Thanks for the suggestion. Unfortunately that's not going to work for my needs; I can't have an empty page hanging around at the end of the document. At that point I might as well embed a script label in the IDMS that I load so I can look it up with that label after placing it on the page. I'm surprised this hasn't been fixed as it's a tool that was available in Extendscript so it's not a new feature.

Phil 815
Inspiring
April 2, 2024
quote

@Robert at ID-Tasker without getting too into the weeds, the script we're writing is for production use by our stakeholders. So we don't want to require them to manually remove a page in their workflows.

[...] 


By @Phil 815

 

???

 

Who said anything about removing manually?

The same way as you are adding page -

 

myDoc.pages.add()

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#Pages.html#d1e205795__d1e205844

 

the same way you can remove it:

 

myDoc.pages[-1].remove()

 


Thanks Robert!

Agreed that this would allow us to get the reference, but it's still not the workflow we're looking for. We want the user to be able to place the textframe in a spot they choose, not on a separate page. So I think we'd be losing the benefit of the placeGun even though we would have a reference to the textframe. Having said that I'll try some form of your suggestion today and get back. I'm also going to try the script label idea I mentioned.