Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added first draft of make pages script #8

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

brianp126
Copy link
Collaborator

Hi Chris, sorry for the delay. Here is my first pass at the makePages script. Would be good to test on a live json payload. I have some alerts for error handling, but could set up a logging function instead since if there's a problem with some of the json it may alert a lot. Let me know what you think. Thanks.

Hi Chris, sorry for the delay. Here is my first pass at the makePages script. Would be good to test on a live json payload. I have some alerts for error handling, but could set up a logging function instead since if there's a problem with some of the json it may alert a lot. Let me know what you think. Thanks.
@ChrisHardie ChrisHardie self-assigned this Nov 17, 2023
@ChrisHardie
Copy link
Member

ChrisHardie commented Apr 16, 2024

@brianp126 I finally had a chance to look at this today. Had to do a few things to make any progress with it:

  • Move the script in to the Scripts Panel dir, otherwise it was not available in the INDD UI
  • Comment out the || /indd?t?$/gi.test(tmplt.name) test on the template name, it always failed
  • Set a separate API URL and temp file for storing the JSON response, since the script will work alongside our article fetching script

Beyond that, I'm stuck and need some assistance:

  1. The parentPage name fetcher seems broken for every scenario, and I suspect it related to template tweaks you made, so hoping you can share notes on those. I tried hard-coding to C-Odd for testing for now.
  2. The line doc.pages.item(0).name = pageNum; throws the error "Error: 'name' is a read-only property"
  3. If I comment that line out, I start to get other errors like "Error: could not set text variable Date: Error: Object does not support the property or method 'customTextVariablePreferences'"

Thanks for any guidance you can offer. Example JSON for testing:

{"issue_date":"2024-04-03","page_count":32,"pages":[{"pageNum":1,"color":true,"layout":"Odd"},{"pageNum":2,"color":true,"layout":"Even"},{"pageNum":3,"color":true,"layout":"Odd"},{"pageNum":4,"color":true,"layout":"Even"},{"pageNum":5,"color":false,"layout":"Odd"},{"pageNum":6,"color":false,"layout":"Even"},{"pageNum":7,"color":false,"layout":"Odd"},{"pageNum":8,"color":false,"layout":"Even"},{"pageNum":9,"color":false,"layout":"Odd"},{"pageNum":10,"color":false,"layout":"Even"},{"pageNum":11,"color":false,"layout":"Odd"},{"pageNum":12,"color":false,"layout":"Even"},{"pageNum":13,"color":true,"layout":"Odd"},{"pageNum":14,"color":true,"layout":"Even"},{"pageNum":15,"color":true,"layout":"Odd"},{"pageNum":16,"color":true,"layout":"Even"},{"pageNum":17,"color":true,"layout":"Odd"},{"pageNum":18,"color":true,"layout":"Even"},{"pageNum":19,"color":true,"layout":"Odd"},{"pageNum":20,"color":true,"layout":"Even"},{"pageNum":21,"color":false,"layout":"Odd"},{"pageNum":22,"color":false,"layout":"Even"},{"pageNum":23,"color":false,"layout":"Odd"},{"pageNum":24,"color":false,"layout":"Even"},{"pageNum":25,"color":false,"layout":"Odd"},{"pageNum":26,"color":false,"layout":"Even"},{"pageNum":27,"color":false,"layout":"Odd"},{"pageNum":28,"color":false,"layout":"Even"},{"pageNum":29,"color":true,"layout":"Odd"},{"pageNum":30,"color":true,"layout":"Even"},{"pageNum":31,"color":true,"layout":"Odd"},{"pageNum":32,"color":true,"layout":"Even"}]}

@brianp126
Copy link
Collaborator Author

Hey Chris, wanted to flag that I did send an updated version of the script via Upwork

@ChrisHardie
Copy link
Member

I brought in the latest changes from @brianp126 here, pending discussion (currently in Upwork messges) about how to handle template page labels.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants