Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

HOW TO: automate chat Layout with text from .txt file

Return to Member Forum

  • Author
    Posts
    • #1180603

      Hello!
      I want to create a book from an exported WhatsApp chat. The chat is exported as .txt file, while all the send media is stored in a folder as separate .jpeg, .wav, etc.
      The chat looks like this:

      14/01/2015, 13:28:40: Person 1: texttexttext
      14/01/2015, 13:29:57: Person 2: texttexttext
      14/01/2015, 15:00:37: Person 2: 2018-01-14-PHOTO-00000003.jpg <attached>
      14/01/2015, 15:00:48: Person 2: texttexttext
      14/01/2015, 15:45:40: Person 1: texttexttext
      17/02/2015, 20:46:59: Person 2: texttexttext
      17/02/2015, 21:27:33: Person 1: texttexttext
      17/02/2015, 22:01:23: Person 2: texttexttext

      What I would like to do now is create a layout for this chat that looks more like an actual chat (textboxes, person 1 right-bound, person 2 left-bound, place the image files, etc.), and I have no problem doing this particular part. But the work only starts there, because the chat has 8723 messages.

      My question is now: what kind of features are built into InDesign that could automate parts of the work?

      Essentially I don’t want to adjust 8723 textboxes individually, so I was thinking of some kind of a script that would create textboxes right-bound/left-bound based on person 1/2, adjust their size depending on length of message, keep equal spacing between each message, maybe even place the media and scale it, an so on. I would be super happy if someone can help, cause for now the amount of work is simply daunting.

    • #14324302
      Jeremy Howard
      Participant

      Hello Jakob,

      Something like this would not be possible via any native InDesign features that I am aware of but this is absolutely possible via scripting. This is more than I am willing to do for free but I would be more than happy to point you toward resources where you could learn about scripting or we could potentially work out some sort of agreement…

      I will work on digging up some resources for you to look over, look for them in my next reply!

    • #14324301
      David Blatner
      Keymaster

      Hey Jeremy, I think the text-to-image thing could be handled with a free script (there are several), but I think many of his other needs can actually be done pretty easily with Find/Change and so on. It depends a lot on the actual design he needs.

    • #14324296
      Jeremy Howard
      Participant

      That is true, I hadn’t considered using a find change to accomplish this… I may need to enter the lab and see what I can cook up on this… If it turns out that you are right and I am able to figure it out then I will be sure to post the solution in this thread!

    • #14324295
      Jeremy Howard
      Participant

      Well, I’ll be! It turns out that I had jumped to quickly to a scripted solution when there are indeed ways of doing this with a GREP find and replace… David, this is why you are the master!

      I began by creating a paragraph style named “Person 1” and I applied some paragraph border and paragraph shading options until I was fairly happy with the look. When doing this yourself, you will want to make sure that you pay attention to the “Corner Size And Shape” options (I rounded them a bit), the “Offsets” options (I increased mine a bit) and the “Width” option (I set mine to “text” so that it didn’t span the entire frame). In Addition to the shading, I suggest using the “space before” and/or “space after” settings to create some space between each of the messages.

      After I got the “Person 1” style set up more or less to my liking, I created a new “Person 2” style and based it on “Person 1” so that I only needed to change the color of the paragraph shading and the text justification and that style was done.

      Now that the two styles were set up, it was time go get to the GREP. Here are the strings that I used:

      In the GREP find field I entered: ^.+(Person 1).+$

      And then I chose the “Person 1” paragraph style in the “Change Format” dialog, clicked “Change All” and presto! All of the Person 1 messages were now styled as messages. A quick rinse and repeat to target the “Person 2” messages and the formatting was done.

      As far as placing images using text, I think that I posted a nice little script on InDesign Secrets as a response to a post a while back. I’ll see if I can dig it up!

    • #14324277

      Hello! Thanks a lot for your effort, a GREP seems to be indeed a good idea! I’ll try out the steps Jeremy suggested later today and see what results I can get. I’ll be reporting my progress!

    • #14324253
      David Blatner
      Keymaster

      Here’s a video of how I would handle much of this challenge:

      See the notes under the video to download an IDML file with the styles I used, etc.

    • #14324242
      Jeremy Howard
      Participant

      Great video David, very well done! You definitely took it further than I had been envisioning!

    • #14324229

      Thanks a lot for the video! Helps a lot!

Viewing 8 reply threads
  • You must be logged in to reply to this topic.
Forum Ads