Copy link to clipboard
Copied
Hi,
is there a way/script to create a list box in document template? I would like to prepare a template for another user, where he/she creates a document with pictures and metadata captions, and has an option to specify the content of these metadata before exporting final document as .pdf. I would prefer dropdown list more than textfield or another editing of exported document.
Thank you
Copy link to clipboard
Copied
I'm going to move this to the InDesign Scripting forum for you, Luku1822, to increase the chances of getting you an answer.
~Barb
Copy link to clipboard
Copied
Hello.
Yes, of course. But you need to be more specific about what you want.
Copy link to clipboard
Copied
So I could imagine an event-listener that fires when you open your template. You probably want to tag this template with some identifier so that the event-listener can be smart about when to take the next step.
Which would be displaying a panel with your dropdown menu. Where does your list of choices come from? It's simple to hard-code it into your script, but that can be hard to maintain.
Then comes the script that places the pictures and captions the user selects in the dropdown. Depending on the complexity of the layout, you might want to think about storing the various geometries in a library, so that the script simply has to place the appropriate library asset. Again, a matter of maintenance: It's usually easier to modify a library item than to edit a script.
I could even imagine a world where the library informs the drop down. In other words, you store a library asset with a name or "description" that you want displayed in your dropdown. But that might be getting ahead of story.
Bob
Copy link to clipboard
Copied
Hi
thank you for your reply
Well my layout is not complex at all, a few lines, captions and a picture. Every caption has a corresponding description in a text frame. I would like this text field to behave like combo box before I export document to pdf. Editable list of choices would be the best solution, but it is not necessary, i can imagine updating it very rarely. Another reason is that it´s not even possible (to my knowledge) to set the font type except height when creating combo/list box..
thank you for your time!
Lucas
Copy link to clipboard
Copied
Not sure what we're supposed to be looking at here.
If you're looking for an interactive document, I can't help you. I'm just a humble newspaperman and we don't go in for buttons and dropdowns on our pages.
My thought would be to use ScriptUI to create a custom panel.
Copy link to clipboard
Copied
As Robert Mentioned, It would be easy to do with a UI. You could almost create the document with a UI, have the person fill in the UI, the when Ok is clicked, it populates your template.
Copy link to clipboard
Copied
Another way would be to use a contextual rightClick menu driven by script. The only problem would be to "contextualize" the values. I mean that if you right click on "City", you would want the menu to display cities and locations for location. That would mean predict the meaning of the clicked string and display the valuable data.
I can't agree more but requesting the user to pick data before to populate them.
Copy link to clipboard
Copied
Well, the OP said the ultimate goal is to populate the new document with pictures and captions. He doesn't say where these items come from, but if there's a folder structure on a server, the script could easily read that. Maybe one folder for all source files, with subfolders with the names of countries,each containing the pictures. So the script uses subfolder names to populate the dropdown. Then the user selects one and the script places the image files from that subfolder.
I've also found it fairly easy to use a text file with the .CSV format. Maybe the first cell in each row is the name of a country and the rest of the row contains filepath information for the pictures. It's easy for most users to open the .CSV in Excel and add new data, and it's also easy for a script to read it as a text file to populate the dropdown and then to locate the source files.