Hi Robert,
It's doable but can be tricky. There is a ;;V field format print
modifier that tells DP to not 'escape' control codes so that you can
pass printer codes stored in an RV.
When doing this, you have to remember that numbers shown in a printer
control string as <num> are actually converted by DP to the ASCII
character represented by num. So if you had <3> in a printer control
string, DP is actually going to output ASCII code 3 (which is a heart
♥), not an actual '3' (which is ASCII code 51). When you're formulating
your printer control code inside a RV, you don't use the < >, you have
to actually use the ASCII codes. So instead of <3> you have to type the
actual heart character (by holding Alt and typing 3 on the numeric
keypad). One issue with this is that there's no way to pass <0> since
you can't type ASCII code zero from the keyboard. So hopefully that
won't be a character vital to your code.
Here's an example:
Suppose you want to ask the user how many characters wide the left
margin should be, and then send the code for their choice. You would
need something like this (hopefully the ASCII chars will come through in
this message):
---Prompt for RV:1--- (format G9 or N9 to allow number 0 to 9 to be
entered)
---Printer Control String: <192><0><0><0><0><192>--- (default setting of
no margin)
---Store Value in RV2:--- (build the code)
if rv1 <> 0 then
cat.c["└☺☺";
rv1 cases
case cv=1 of "☺" endof
case cv=2 of "☻" endof
case cv=3 of "♥" endof
case cv=4 of "♦" endof
case cv=5 of "♣" endof
case cv=6 of "♠" endof
case cv=7 of "•" endof
case cv=8 of "◘" endof
case cv=9 of "○" endof
endcases;
"☺└"]
else
""
endif
---Print RV2 with format A6;;V--- (don't try using A0A0;;V, it won't work)
A couple of things to note: (1) Since we can't generate a <0> code
inside the RV, I first send the Printer Control Code to set the left
margin to zero. That way if the user entered 0 it gets set. If the user
entered anything other than 0, the code will be built inside the RV and
will end up overriding the first one. (2) Inside the rv, since we can't
generate a <0> I used the equivalent of a <1> ☺. It doesn't matter there
because those codes are ignored by DPSpool.
Have fun!
Tim
On 2/26/2017 8:45 AM, Robert Kendall wrote:
> I use DPSpool to print labels on 80 labels/sheet forms. Sometimes a box of
> labels will be shifted a little vertically or horizontally. I usual change my
> printer control margin parameters to adjust for this. But is there some way I
> could make the adjustments at the time I run the labels report using a Prompt
> for Report Variable?
>
> Robert Kendall
>
> Sent from my iPhone
> _______________________________________________
> Dataperf mailing list
> [email protected]
> http://lists.dataperfect.nl/cgi-bin/mailman/listinfo/dataperf
_______________________________________________
Dataperf mailing list
[email protected]
http://lists.dataperfect.nl/cgi-bin/mailman/listinfo/dataperf