Page Index Toggle Pages: 1 2 3 [4]  Send Topic Send Topic Print Print
Very Hot Topic (More than 25 Replies) MergeFilePrint() Questions (Read 10102 times)
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: MergeFilePrint() Questions
Reply #45 - Mar 26th, 2008 at 3:43pm
Print Post Print Post  
You are right Erika. I am strictly talking about RTF file format with MergeFilePrint() command. RTF seems to address the most of the merge print needs and I have come to like it so much. I have realized that MergeFilePrint() command takes care of other file formats such as HTM, PS and txt in addition to RTF and I believe some of the limitations with RTF file are particularly linked to that broad applicability.  With RTF fomat, since most of the issues can be handled from Sesame side with s-basic, I can live with it.  However, RTF file is method of choice as mentioned in the Programming Guide, separate command could be made available addressing to the need of just RTF file. Or am I asking too much?

Quote:
We are looking at this and will do what we can,

Thanks.
  
Back to top
 
IP Logged
 
BOBSCOTT
Senior Member
Members
*****
Offline


That Darn Computer #$X#
{curse words}

Posts: 1195
Joined: Nov 22nd, 2002
Re: MergeFilePrint() Questions
Reply #46 - Mar 26th, 2008 at 6:37pm
Print Post Print Post  
Thanks for the concise write up guys this thread is extremely helpful.

In my experience I have found that for me the sbasic printstring() commands to be my best option if multiple users / machines will be using the application. Every time I have deployed an application using mergefile something is different on one machine or someone upgrades the word processor program and the merge has issues. It takes me a little longer to get my output just the way I need it with Sbasic and printstring() commands but it works fine every time on every machine. I have 1 user using ubuntu Linux and it works as well as the Vista or XP user machines outputing with printstring().

I for one am hooked on Printstring()  Smiley
  

Team – Together Everyone Achieves More
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: MergeFilePrint() Questions
Reply #47 - Mar 26th, 2008 at 9:03pm
Print Post Print Post  
Hi Bob,  You are the one who started this thread!

Yes, this is indeed an eye opener as to what simple one line command can do for you. I have gone through the drudgery of going through customizing and formating values in MS Word using Mergefield switches and going through Word Macro and even a little of VB and all that for practically nothing and never could get it to work to my 100% satisfaction.

As far as @PrintString ( ) goes, I like it and have used it for precise printing as it is required in  pre-printed forms.  But for an average user, one has to work with it and devote quite a long time to be comfortable using it and get some great results. But you are right, once you get it to work, there is no looking back. It will work great every  time and since no external program involved, we are not at the mercy of other program or company.

Credit goes to Sesame development team to provide us with all different tools to work with and meeting everybody's needs as per ones comfort level, temperament and working knowledge.

For me, I have come to rely on MergeFilePrint() in RTF format for my mergeprint requirement and very happy with it so far.  This thread has explored the command to the fullest.... or may be not. Still a lot can be done with it!!!
« Last Edit: Mar 26th, 2008 at 11:06pm by Bharat_Naik »  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: MergeFilePrint() Questions
Reply #48 - Mar 27th, 2008 at 7:11pm
Print Post Print Post  
For AlternateDefaultPrinter ( ) with MergeFilePrint() command, I was exploring if it is possible to change the Default printer on the fly with commandline code in Windows Operating system. Here what I have found...

http://www.robvanderwoude.com/2kprintcontrol.html

Set printer as default
    RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "printer"

Restore all printer settings from a file
    RUNDLL32 PRINTUI.DLL,PrintUI /Sr /n "printer" /a "file.dat"

I have not tested it yet but looking at this, it seems that this could be used with @Shell command to change AlternateDefaultprinter() on the fly using SBasic  with MergeFilePrint() command using RTF file option or am I just dreaming? 


  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: MergeFilePrint() Questions
Reply #49 - Mar 27th, 2008 at 9:44pm
Print Post Print Post  
Set printer as default
    RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n "printer"

The above command seems to work fine. I ran that using "RUN" box and it did change the default printer.

However I do not understand how to set up the following file in order to reset the default printer again.

Restore all printer settings from a file
    RUNDLL32 PRINTUI.DLL,PrintUI /Sr /n "printer" /a "file.dat"


Or just may be I can use the first command again to set the normal default printer. One before the the MergeFilePrint() command and one after to reset to original printer. I would appreciate the guidance in this matter.  Thanks.

Bharat
  
Back to top
 
IP Logged
 
Ray the Reaper
Global Moderator
Members
Lantica Support
*****
Offline


The One & The Only

Posts: 2480
Joined: Aug 20th, 2003
Re: MergeFilePrint() Questions
Reply #50 - Mar 28th, 2008 at 1:31pm
Print Post Print Post  
Hello Bharat,

You can use the /Ss switch to create the file that stores the printer settings.

RUNDLL32 PRINTUI.DLL,PrintUIEntry /Ss /n "printer" /a "file.dat"

-Ray
  

Raymond Yoxall Consulting
ray.yoxall@gmail.com
ryoxall@lantica.com
Sesame Applications, Design and Support
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: MergeFilePrint() Questions
Reply #51 - Mar 28th, 2008 at 5:28pm
Print Post Print Post  
Thanks Ray. I think now incorporating this, we should be able to use any printer on the network with MergeFilePrint ( ) with RTF file and Windows OS without displaying the document to be printed (on the fly).
« Last Edit: Mar 28th, 2008 at 8:44pm by Bharat_Naik »  
Back to top
 
IP Logged
 
Amor
Full Member
Members
***
Offline


No personal text

Posts: 366
Location: Germany
Joined: Feb 7th, 2004
Re: MergeFilePrint() Questions
Reply #52 - Mar 30th, 2008 at 3:52pm
Print Post Print Post  
Hello!

I must say that MergeFilePrint()  beside the Xresult Commands and  the simple Search future are the best true innovation in sesame 2.0.
I use the MergeFilePrint() command to merge data from external applications with its "Matches" parameter.

I can manipulate and format data whatever way i want using s-basic in Sesame itself.

With RTF fomat, can i conditionally change the color of a field from Sesame side with s-basic?

Thank you for the help.

Dr. Belharetrh
  

Dr. med. Amor Belhareth&&Medizin Labor &&Germany
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: MergeFilePrint() Questions
Reply #53 - Mar 30th, 2008 at 5:18pm
Print Post Print Post  
Yes, It can be done. It requires a little work but If your application warrants it, it can be done.

Here how I did it.

First find out the code for Color from RTF file. You can make any dummy file and open it in the Notepad. you will see the code..

For blue it is  -   \cf2\insrsid16728339\charrsid16728339

(The above might have included codes for fonts and other enhancements)

Just place that in front of text that you want to merge.

vName = "\cf2\insrsid16728339\charrsid16728339" + " " + vName


When you assign ";Name=" vName

Name mergefield in the rtf display will be blue.

MergeFilePrint ( ) with RTF file is indeed impressive. Since all your work is done in Sesame with SBasic, you have a lot more control on format of the output.

Bharat

  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: MergeFilePrint() Questions
Reply #54 - Mar 30th, 2008 at 11:31pm
Print Post Print Post  
On testing above further, the code is very inconsistent.  It is hard to terminate it at the end of the mergefield. I really do not know much about RTF format. Just trying to learn using notepad. I am sure someone will get better results and I did.
  
Back to top
 
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: MergeFilePrint() Questions
Reply #55 - Mar 31st, 2008 at 12:32am
Print Post Print Post  
I did a little further studies and following is my take.

RTF file studies:

http://www.biblioscape.com/rtf15_spec.htm

Following code will work and it will terminate the the mergefield color properly unlike the earlier code.

vName = "{\f1\cf6\insrsid13335651\charrsid13335651 " +  vName + "}{\f1\insrsid13335651   }"

Here in the above code cf6 represent the red color. insrsid13335651\charrsid13335651 etc. represent the font and size etc. I believe, you will have to get yours using notepad if it is to match with rest of your document.

cf6 - Red
cf2 - Blue
cf4 - Green
cf7 - Yellow
cf5 - Pink
cf12 - Violet

In the Match parameter the part of the code will be ";Name=" + vName

Where Name is the Merge field in the document.

If vSex = "M" then
        {
                 vName = "{\f1\cf2\insrsid13335651\charrsid13335651 " +  vName +    "}{\f1\insrsid13335651   }"

        }
     Else if vSex = "F" then
        {
                 vName = "{\f1\cf5\insrsid13335651\charrsid13335651 " +  vName +    "}{\f1\insrsid13335651   }"

        }

The above when merged in the document - will produce Blue colors for Boy's Name and Pink for Girl's name!!!




« Last Edit: Mar 31st, 2008 at 2:51am by Bharat_Naik »  
Back to top
 
IP Logged
 
Carl Underwood
Senior Member
Members
*****
Offline



Posts: 1350
Location: New Hampshire
Joined: Mar 11th, 2003
Re: MergeFilePrint() Questions
Reply #56 - Apr 27th, 2008 at 10:55pm
Print Post Print Post  
Quote:
I'm working on a solution. More on this later... Wink

Sorry about the long delay on this issue. I came up with a pretty good solution to the MergeFilePrint() "line-fold" problem with RTF documents. It was good enough to be an article for Inside Sesame, but it was too late to get it in the April issue. Though, I've been informed that it should appear in the May issue, which will be coming out in a few days.
  


Carl Underwood
CDU Computer Consulting LLC
Epsom, New Hampshire
Back to top
IP Logged
 
Bharat_Naik
Senior Member
Members
*****
Offline


Ever ready to learn and
share

Posts: 1202
Location: Chicago,  Illinois
Joined: Dec 16th, 2003
Re: MergeFilePrint() Questions
Reply #57 - Apr 27th, 2008 at 11:11pm
Print Post Print Post  
Thanks Carl. I am looking forward to seeing the solution. In the meanwhile, I am using MergeFilePrint() quite a lot and with good results. I have been using following function to fold and it has been working pretty good.

Function udf_MakeItFlat (vString as String) as String
//vString is Elements and varibles separated by default separator ";"
var vBlock as String
var n as Int

//Build the Block

//WriteLN (vString)

For n = 1 to @CountStringArray (vString)
     //WriteLn ("Number of Strings is " + @Str (@CountStringArray (vString)))      
     If vBlock  =  "" then
           {
                 vBlock = @AccessStringArray (vString, n)
           }
           Else
           {
                 vBlock = vBlock + @NL ( ) + @AccessStringArray (vString, n)
           }

  Next
//WriteLN ("vBlock before Removing Blank lines is " + vBlock)

// Remove blank lines
While @IN (vBlock, @NL( ) + @NL( )) > 0
     {
           vBlock = @Replace(vBlock, @NL() + @NL(), @NL() )
     }
//WriteLN ("vBlock after Removing Blank lines is " + vBlock)

// Insert RTF paragraph tags

vBlock = @Replace(vBlock, @NL(), "\par " )

//WriteLN ("vBlock after placing \par " + vBlock)

Return (vBlock)
End Function
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1 2 3 [4] 
Send Topic Send Topic Print Print