Thanks Jay..There are many contributors here whose RBase chops put me to shame though, so I just do what I can do...
----- Original Message ----- From: "Jay Ward" <[email protected]>
To: "RBASE-L Mailing List" <[email protected]> Sent: Saturday, July 10, 2010 9:14 PM Subject: [RBASE-L] - RE: Available for download - RMScriptPak
Mike, thanks for this and all your help to those of us that are neophytes compared to you. Jay -----Original Message-----From: [email protected] [mailto:[email protected]] On Behalf Of Mike ByerleySent: Saturday, July 10, 2010 7:00 PM To: RBASE-L Mailing List Subject: [RBASE-L] - Available for download - RMScriptPak The RMScript Win32 Dll for use with RBase using DLCall is available for download here: http://www.byerley.net/RMScriptPak.zipI have included a fair amount of useful examples including a couple of formsin a 7.6 / 9.0(32) db exibiting some ways to get you started.The helpfile is included as well as a bunch of other stuff, most of which ismentioned in the ReadMeFirst file.----- Original Message ----- From: "Luc Delcoigne" <[email protected]>To: "RBASE-L Mailing List" <[email protected]> Sent: Friday, July 09, 2010 10:12 AM Subject: [RBASE-L] - re: inserting text in ascii file.Mike, this sounds very tempting. But, alas...I have no idea how my work-schedule will be in October. But I'll certainly keep it in mind...... If I can solve the efilm connection problem, that would give me a second reason to consider your offer .... ;-) Luc D. -------------------------------------------------- From: "Mike Byerley" <[email protected]> Sent: Friday, July 09, 2010 3:59 PM To: "RBASE-L Mailing List" <[email protected]> Subject: [RBASE-L] - re: inserting text in ascii file.Pity that you live on the other side of the atlantic. This is something worth to have a drink togetCome to conference in October and have a drink with everyone....----- Original Message ----- From: "Luc Delcoigne" <[email protected]>To: "RBASE-L Mailing List" <[email protected]> Sent: Friday, July 09, 2010 9:56 AM Subject: [RBASE-L] - re: inserting text in ascii file.Mike, the problem is solved !!! IF (SGET(.vnote,1,.vwrap)) <> ' ' THEN has to be IF (SGET(.vnote,1,.vwrap)) <> (char(32)) THEN and idem for the line in the WHILE-clause. the code works all right now....her.Now: on to the other problem : the connection with efilm.... I hope you can help me out here too..... Luc delcoigne -------------------------------------------------- From: "Mike Byerley" <[email protected]> Sent: Friday, July 09, 2010 1:52 PM To: "RBASE-L Mailing List" <[email protected]> Subject: [RBASE-L] - re: inserting text in ascii file.Well like I said, I wrote it 8+ years ago and haven't looked at it or used it since 2006. What prompted it in the beginning was the joining of db lines of boilerplate text without CrLf and the concantenationwould make the text wrap or break in the middle of words at undesirablelocations. If you take the full example shown below and change the wrapposition, you will see that the output changes to match the wrap location: LABEL bgprog SET VAR v1 TEXT = + 'This is a test to concatenate several lines of text into another ' SET VAR v2 TEXT = +'variable and write the contents of the resulting variable to provide 'SET VAR v3 TEXT = + 'programmers on the R:BASE list server a code sample to see if they ' SET VAR v4 TEXT = + 'are able to duplicate our problem or if we have some type of configuration ' SET VAR v5 TEXT = 'issue. ' SET VAR v6 TEXT = + 'This code wraps the variable at position 30. What we are seeing is ' SET VAR v7 TEXT = + 'spaces in position 31 are not truncated but inserted at the beginning of ' SET VAR v8 TEXT = 'the following line. ' SET VAR vnote NOTE = (.v1 & .v2 & .v3 & .v4 & .v5 & .v6 & .v7 & .v8) CLEAR VAR v1,v2,v3,v4,v5,v6,v7,v8 SET VAR vstrtmp NOTE SET VAR vgetlen INTEGER SET VAR vgettext TEXT SET VAR vstrlen INTEGER --the wrap location SET VAR vwrap INTEGER = 55 SET VAR vcrlf = ((CHAR(13))+(CHAR(10))) SET VAR vstrlen = (SLEN(.vnote)) WHILE vstrlen > 0 THEN SET VAR vsloc = .vwrap --test for location of space at wrap point IF (SGET(.vnote,1,.vwrap)) <> ' ' THEN -- loop backwards till find set var vgetlen = .vsloc WHILE (SGET(.vnote,1,.vsloc)) <> ' ' THEN IF (SLEN(.vnote)) <= .vsloc THEN SET VAR vsloc = (SLEN(.vnote)) SET VAR vgetlen = (SLEN(.vnote)) ELSE SET VAR vsloc = (.vsloc - 1) SET VAR vgetlen = .vsloc ENDIF ENDWHILE SET VAR vgettext = (SGET(.vnote,.vgetlen,1)) SET VAR vgettext = (LJS(.vgettext,.vgetlen)) SET VAR vgettext = (STRIM(.vgettext)) SET VAR vstrtmp = (.vstrtmp + .vgettext + .vcrlf) SET VAR vstrlen = (.vstrlen - .vgetlen) IF vstrlen < 0 THEN SET VAR vstrlen = (SLEN(.vnote)) ENDIF SET VAR vnote = (SGET(.vnote,.vstrlen, (.vgetlen + 1))) ELSE SET VAR vgettext = (SGET(.vnote,.vwrap,1)) SET VAR vgettext = (LJS(.vgettext,.vwrap)) SET VAR vgettext = (STRIM(.vgettext)) SET VAR vstrtmp = (.vstrtmp + .vgettext + .vcrlf) SET VAR vstrlen = (.vstrlen - .vwrap) IF vstrlen < 0 THEN SET VAR vstrlen = (SLEN(.vnote)) ENDIF SET VAR vnote = (SGET(.vnote, .vstrlen, (.vwrap + 1))) ENDIF ENDWHILE SET VAR vnote = (SRPL(.vstrtmp,' ', ' ',0)) LABEL ndproc SHOW VAR vnote=&vwrap AT 5 20 CLEAR VAR vcrlf,vgetlen,vgettext,vsloc,vstrlen,vstrtmp,vwrap RETURN----- Original Message ----- From: "James Bentley" <[email protected]>To: "RBASE-L Mailing List" <[email protected]> Sent: Thursday, July 08, 2010 11:37 PM Subject: [RBASE-L] - re: inserting text in ascii file.Mike,While I don't have time to work on a solution. Several ideas occur. Assome on mentioned you may need to strip out the CR & LF. That seems to be the case from the output shown below. The other is to use the following function to find the space that indicates a word break. (SLOCP(TextNoteVarcharValue,string,occurrence))Locates the exact position of a given string and occurrence in a TEXT,NOTE or VARCHAR value, returning the position if the string is found, 0 if it is not found. Using -1 as the third parameter will return the LAST occurrence. This would allow you to have a moving window into the text/note/varchar variable. I would be interested in seeing your final code as I might have a use for it in one of my applications where Iam breaking in the middle of a word. The app would look much nicer ifa could break on words instead of in the middle of words. Jim Bentley American Celiac Society [email protected] tel: 1-504-737-3293 ----- Original Message ---- From: Mike Byerley <[email protected]> To: RBASE-L Mailing List <[email protected]> Sent: Thu, July 8, 2010 4:19:50 PM Subject: [RBASE-L] - re: inserting text in ascii file.Send me an example text file (direct off list) if you can. Also, showme a dozen or so lines of the code you are using to collect the file contents into a variable. Also show any pertenant variable declarations. ----- Original Message ----- From: "Luc Delcoigne" <[email protected]> To: "RBASE-L Mailing List" <[email protected]> Sent: Thursday, July 08, 2010 5:06 PM Subject: [RBASE-L] - re: inserting text in ascii file.Mike, i tried your code and I got this : " normale koepelstanden. vrije laterale en dorsale sinussen, zonder tekens van pleuravocht. normale hartgrootte. scherpe aflijning van de hili. norm ale breedte van het bovenste mediastinum. mediane positie van de trachea. normale aeratie van de longvelden. homogene aeratie van de longvelden, z onder confluerende infiltraten noch verdachte opaciteiten. normale botst ructuren. " Never mind the dutch language, The line-length is OK and is set to 75. but as you see I still get some words that are chopped. How could I solve this ? Luc -------------------------------------------------- From: "Mike Byerley" <[email protected]> Sent: Thursday, July 08, 2010 10:41 PM To: "RBASE-L Mailing List" <[email protected]> Subject: [RBASE-L] - re: inserting text in ascii file.It looks like I wrote it eight years ago to solve a different problem. It just happens it will likely work for yours. You can change the wrap variable to any number and it will insert a CrLf at that location. I can think of another solution to the problem that might be a little quicker. Take the variable that contains the file contents, strip out all of the CrLf,then process from the beginning using some of the logic in the code Isent, the difference being instead of concantenating Notes on the fly, you would add completed lines to a variable user defined ListBox and when you are done, you can use the ListBox's Save_To_File method. If the length of the file contents isn't too long, there might not be such distinguishable difference, so what I sent would probably work without reinventing it all over again. ----- Original Message ----- From: "Luc Delcoigne" <[email protected]> To: "RBASE-L Mailing List" <[email protected]> Sent: Thursday, July 08, 2010 4:30 PM Subject: [RBASE-L] - re: inserting text in ascii file.Mike,This is more than just a forum. This is really a place where peoplehelp people. I must say that R:base has been so far a heart-warming experience. Thank you. I will try the code immediately. Too hot to go to sleep over here. Luc Delcoigne -------------------------------------------------- From: "Mike Byerley" <[email protected]> Sent: Thursday, July 08, 2010 10:25 PM To: "RBASE-L Mailing List" <[email protected]> Subject: [RBASE-L] - re: inserting text in ascii file.Is the problem that after you have it (the file) converted to a Text variable (is it TEXT or VARCHAR), that the word wrap is beyond 75 characters? If it is, I have some old rbase code that wraps text at a designated maximum width. Also, after you get the DLL, you will be able to process text files any way that is permitted within the VBScript Language. The RBASE CODE: {begin code} LABEL bgprog SET VAR vnote NOTE = (.vVariableOfMyTextFileContents) CLEAR VAR v1,v2,v3,v4,v5,v6,v7,v8 SET VAR vstrtmp NOTE SET VAR vgetlen INTEGER SET VAR vgettext TEXT SET VAR vstrlen INTEGER --the wrap location SET VAR vwrap INTEGER = 75 SET VAR vcrlf = ((CHAR(13))+(CHAR(10))) SET VAR vstrlen = (SLEN(.vnote)) WHILE vstrlen > 0 THEN SET VAR vsloc = .vwrap --test for location of space at wrap point IF (SGET(.vnote,1,.vwrap)) <> ' ' THEN -- loop backwards till find set var vgetlen = .vsloc WHILE (SGET(.vnote,1,.vsloc)) <> ' ' THEN IF (SLEN(.vnote)) <= .vsloc THEN SET VAR vsloc = (SLEN(.vnote)) SET VAR vgetlen = (SLEN(.vnote)) ELSE SET VAR vsloc = (.vsloc - 1) SET VAR vgetlen = .vsloc ENDIF ENDWHILE SET VAR vgettext = (SGET(.vnote,.vgetlen,1)) SET VAR vgettext = (LJS(.vgettext,.vgetlen)) SET VAR vgettext = (STRIM(.vgettext)) SET VAR vstrtmp = (.vstrtmp + .vgettext + .vcrlf) SET VAR vstrlen = (.vstrlen - .vgetlen) IF vstrlen < 0 THEN SET VAR vstrlen = (SLEN(.vnote)) ENDIF SET VAR vnote = (SGET(.vnote,.vstrlen, (.vgetlen + 1))) ELSE SET VAR vgettext = (SGET(.vnote,.vwrap,1)) SET VAR vgettext = (LJS(.vgettext,.vwrap)) SET VAR vgettext = (STRIM(.vgettext)) SET VAR vstrtmp = (.vstrtmp + .vgettext + .vcrlf) SET VAR vstrlen = (.vstrlen - .vwrap) IF vstrlen < 0 THEN SET VAR vstrlen = (SLEN(.vnote)) ENDIF SET VAR vnote = (SGET(.vnote, .vstrlen, (.vwrap + 1))) ENDIF ENDWHILE SET VAR vnote = (SRPL(.vstrtmp,' ', ' ',0)) LABEL ndproc show var vnote=.vwrap at 5 20 CLEAR VAR vcrlf,vgetlen,vgettext,vsloc,vstrlen,vstrtmp,vwrap RETURN {end code} ----- Original Message ----- From: "Luc Delcoigne"<[email protected]>To: "RBASE-L Mailing List" <[email protected]> Sent: Thursday, July 08, 2010 4:09 PM Subject: [RBASE-L] - re: inserting text in ascii file. Hi all, I've been sweating all day long on this problem. In a ascii file I have to insert the contents of a rtf- blob. With the RRTFtoTxt pluging I could convert the it to a text variable. Now I can insert the text variable in my file. BUT the lines of the inserted text cannot be longer than 75 characters. This is an essential part of my application. Without this I could be forced to stick with Access where I can manipulate the file with the Wordobj....and I love R:base... Any ideas ?? Grtz Luc Delcoigne

