Author Topic: How would you?  (Read 6641 times)

0 Members and 1 Guest are viewing this topic.

Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
Re: How would you?
« Reply #30 on: May 12, 2010, 09:36:48 AM »
Michel,
I'm in awe.

I ran the GetCharWidths handler, got 0.0332...

When you say only run that handler once, would that mean I can remove code lines 001-008, as well as 022-042?

Offline Publi-Script

  • Administrator
  • Hero Member
  • *****
  • Posts: 596
  • Karma: 16
  • Gender: Male
  • Automate your Life!
    • Publi-Script.com
Re: How would you?
« Reply #31 on: May 12, 2010, 10:15:50 AM »
In short... NO!

001 -> You NEED this line in the main script, BUT, after running the GetCharWidths() handler, you need to copy the resulting list (all 255 items) withing the empty brackets.
002 -> You NEED this in the main script to return the width of a single space.
003 -> You can DELETE this line
004 - 008 -> You NEED these lines (it should have been 1 line really) in the main script. This is the line that will return your separated lines given your column width.
022-042 -> You can DELETE these lines.

It appears that you only have the last CharWidth measured, to ensure that you see them all, add the following line after theGetCharWidths() call:

    return CharWidth

Replace the empty curly braces of you CharWidths property with the content of the result window.

HTH
Michel Lemieux
Forum Administrator
-------------------------
OS X 10.6.4
Quark 6.5 / 7.5 / 8.1.6
Adobe Design Premium CS / CS2 / CS3 / CS4 / CS5
Script Debugger 4.5

Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
Re: How would you?
« Reply #32 on: May 12, 2010, 11:24:55 AM »
Would I copy the values as points or need to translate them as real?

ie: {"p1.8", "p1.994", "p2.671", "p3.6", "p3.6"}
« Last Edit: May 12, 2010, 11:29:33 AM by AutoFetishist »

Offline Publi-Script

  • Administrator
  • Hero Member
  • *****
  • Posts: 596
  • Karma: 16
  • Gender: Male
  • Automate your Life!
    • Publi-Script.com
Re: How would you?
« Reply #33 on: May 12, 2010, 12:35:33 PM »
Values should already be as REAL as per line 037 and that is what they need to be
Michel Lemieux
Forum Administrator
-------------------------
OS X 10.6.4
Quark 6.5 / 7.5 / 8.1.6
Adobe Design Premium CS / CS2 / CS3 / CS4 / CS5
Script Debugger 4.5

Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
Re: How would you?
« Reply #34 on: May 12, 2010, 04:00:23 PM »
questions, questions...

why, in lines 022-042, do you separate ASCII characters 1-31 from characters 32-255?

Would I replace lines 004-008 with my document's text?

 

Offline Publi-Script

  • Administrator
  • Hero Member
  • *****
  • Posts: 596
  • Karma: 16
  • Gender: Male
  • Automate your Life!
    • Publi-Script.com
Re: How would you?
« Reply #35 on: May 12, 2010, 05:28:08 PM »
The first 31 Ascii characters are special characters and have no width. I put them in anyway just to be able to access the list with the AsciiNum of any char without having to substract 31 every time.

Yes your text will go on lines 004-008 but be careful to keep the handler call part as well as the column width parameter.
Michel Lemieux
Forum Administrator
-------------------------
OS X 10.6.4
Quark 6.5 / 7.5 / 8.1.6
Adobe Design Premium CS / CS2 / CS3 / CS4 / CS5
Script Debugger 4.5

Offline cdms

  • Full Member
  • ***
  • Posts: 111
  • Karma: 6
  • Gender: Male
Re: How would you?
« Reply #36 on: May 13, 2010, 01:15:52 AM »
I maybe speaking out of turn here, but the way I read this and looking at your example document, you cannot just put all your documents text into this in one go. I think you need to chop your text off at the first tab, pass each front bit through this handler and then stick it back onto the front of the other columns.
With a small doc I would be tempted to do all this in an array in the script, however, if your example is a typical size doc it may be better to do it one line at a time and build the results back into a second text box.
Although your character count method is not accurate there should be some lower number that is safe just to help prevent unnecessary passes through.


Offline Publi-Script

  • Administrator
  • Hero Member
  • *****
  • Posts: 596
  • Karma: 16
  • Gender: Male
  • Automate your Life!
    • Publi-Script.com
Re: How would you?
« Reply #37 on: May 13, 2010, 07:53:33 AM »
You are not speaking out of turn, these are valid points you are making.

I did not state this but you are right, this handler on process the text that makes up the content of 1 visual cell. Of course, it could be modified to accept the text of the whole table and return the formatted table text.
Michel Lemieux
Forum Administrator
-------------------------
OS X 10.6.4
Quark 6.5 / 7.5 / 8.1.6
Adobe Design Premium CS / CS2 / CS3 / CS4 / CS5
Script Debugger 4.5

Offline AutoFetishist

  • Sr. Member
  • ****
  • Posts: 397
  • Karma: 2
  • Gender: Male
Re: How would you?
« Reply #38 on: May 13, 2010, 08:43:26 AM »
You're right cdms, the handlers would need to be pointed at each paragraph in the story.

I know I might be the only one, but I think this is fascinating. Thanks to both of you.