Skip to main content
Participant
November 5, 2012
Question

how to set if, else???

  • November 5, 2012
  • 1 reply
  • 970 views

for example:

if i want to text convert to table.

If have ";" x 4

header1;header2;header3;header4

col1;col2;col3;col4

(script 1)

Header 1Header 2Header 3Header 4
col1col2col3col4

else

if have ";" x5

(script 2)

var myTable = app.selection[0].convertToTable(";","\r");

header1;header2;header3;header4;header5

col1;col2;col3;col4;col5

Header 1Header 2Header 3Header 4Header 5
col1col2col3col4col5

and if have ";"x6 =(script 3), ";" x 7 = (script 4), ";" x8  (scr.......

i want only use a script to do, how can i do that??

thankyou>< love your

This topic has been closed for replies.

1 reply

Jongware
Community Expert
Community Expert
November 5, 2012

You don't have to count the number of ;'s. The function convertToTable will never create more columns than needed.

AlienLaiAuthor
Participant
November 6, 2012

thankyou your help.

but i want to set colnum wifth.

different colnum number different width...

example: if ";" x3

col1 width = "90 mm" col2 = "30mm" col3 = "30mm"

of ";" x 4

col1 width = "75mm" cold 2 width = "25mm" col 3 width = "25mm" col 4 width = "25mm"

because i have many script 1 for 3 column, script 2 for 4 column.

how can i integrate to one script.

Jump_Over
Legend
November 6, 2012

Hi,

Could you find a rule when calculating columns width?

Could it be: 1st column is 3 times wider then the rest?

If your table width is a textFrame width - all the rest is mathematics

and can be done in one loop.