Topic Options
#30263 - 08/17/09 10:55 AM Variable Line width
Mario Offline
OL User

Registered: 05/06/08
Posts: 58
Loc: Holland
Hi,

I have a data file with numbers from 1 till 15000 all mixed trough each other.

When number 1 till 9 comes i need to print a short line of 1 inch
On numbers 10 till 99 i need to print a short line of 2 inch
On numbers 100 till 999 i need to print a short line of 3 inch
On numbers 1000 till 9999 i need to print a short line of 4 inch
On numbers 10000 till 99999 i need to print a short line of 5 inch

Can anyone help me make this piece of presstalk?
Thanks!

Top
#30264 - 08/17/09 11:24 AM Re: Variable Line width
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4956
Loc: Objectif Lune Montreal
Mario,

Create a "line" shape object. For it's width, you can use an expression like this:

Code:
=inttofloat(length(@(1,1,5)))
This will give you a width equal to the number of characters in your string. Replace the coordinates 1,1,5 by your own coordinates. (line number,start column,end column)

Regards,
Rapha

Top
#30265 - 08/18/09 01:52 AM Re: Variable Line width
Mario Offline
OL User

Registered: 05/06/08
Posts: 58
Loc: Holland
Thanks,

I copied en paste this into width but it doesnt work as i want it to...
The lines are to to long now..
How can i make them smaller?

When i have number 1 now in my data, the line is about 1 ince (like what i wanted in my first post :rolleyes: ), but its to long.
I want it just as wide as my numbers are.
(Arial bold 50pt)
Kind of the same idea as an underline, only i need to use the line on a other place in my document.

Top
#30266 - 08/18/09 09:23 AM Re: Variable Line width
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4956
Loc: Objectif Lune Montreal
Mario,

The code above sets the line's width to 1 inch per digits in the number.

If you want the line to be about the same total length as the number if you use a proportional font, then it's a little more complicated. But here's a way to do it.

First, create a global variable of measure type. Let's call it "linewidth". Then, create your data selection that will display the number. Make sure you check the "trim" options, and in it's PressTalk After properties, use this code:
Code:
&linewidth := &width
Then create your line, and you can set it's width to &linewidth. This will make the line the same width as the number. You can then make some adjustments using + or - if you need to.

Hope that helps.

Regards,
Rapha

Top
#30267 - 08/18/09 09:53 AM Re: Variable Line width
Mario Offline
OL User

Registered: 05/06/08
Posts: 58
Loc: Holland
I created the global variable of measure type, called it linewidth as name and ID.
Then created my data selection and set trim and center on, but when i insert the presstalk after code it gives an error:

PTK0138: Unknown Instruction &linewidth = &width width line "&linewidth = &width" in object $_InternalTempObj_
PTK083 object [$_InternalTempObj_] is empty, possible compile error

Top
#30268 - 08/18/09 09:54 AM Re: Variable Line width
Raphael Lalonde Lefebvre Offline
OL Expert

Registered: 10/14/05
Posts: 4956
Loc: Objectif Lune Montreal
You actually need to put ":=" instead of "=". I've edited my original post. Sorry for that.

Rapha

Top
#30269 - 08/19/09 05:55 AM Re: Variable Line width
Mario Offline
OL User

Registered: 05/06/08
Posts: 58
Loc: Holland
Haha no problem!!

Thanx for your help!!

Top