|
Post by tenochtitlanuk on Aug 31, 2020 16:38:32 GMT -5
It's easy to programmatically control a linear analog display like this. An example is on my website, displaying a Celsius thermometer varying up and down ( and also the code only allows you to load/run it 5 times in a kind of copy-protection) Download and unzip this fileProgress bars need a way to know how long something should take, so you can move the bar to 50% when the job is half done. In most cases this can only be approximate.
|
|
|
Post by tenochtitlanuk on Aug 31, 2020 3:46:29 GMT -5
Beep is silent on my LB-under-Wine in Linux.... and I virtually never use Microsoft these days.
|
|
|
QR code
Aug 30, 2020 16:41:12 GMT -5
Post by tenochtitlanuk on Aug 30, 2020 16:41:12 GMT -5
Sorry- an extra 'return' seems to have crept in. The old laptop /Linux I'm using has a dodgy touchpad, and it does odd things when I'm editing data. I just cut from LB and pasted to the forum, so not sure how it happened!! The following are all one line- the spaces were just to align ( in a mono-spaced editor font) to emphasize that all the lines were basically similar.
print dataBetween$( "<cbc:Percent>" , "</cbc:Percent>", data$),
|
|
|
QR code
Aug 30, 2020 5:31:59 GMT -5
Post by tenochtitlanuk on Aug 30, 2020 5:31:59 GMT -5
I think the following code correctly finds the two cases. But are other possibilities than ZZ or EA possible?
start$ ="<cac:InvoiceLine>" lenS =len(start$) finish$ ="</cac:InvoiceLine>" lenF =len( finish$)
quotes$ =chr$( 34)
open "UBLTestEAZZ.xml" for input as #fIn file$ =input$( #fIn, lof( #fIn)) close #fIn
current = 1
print "Name"; tab( 30); "Taxable amount Tax amount Invoiced quantity Percent Price" PRINT ""
[look] pointer =instr( file$, start$, current) if pointer <>0 then endItem =instr( file$, finish$, pointer +2) data$ =mid$( file$, pointer +lenS , endItem -pointer -lenF) current =endItem
print dataBetween$( "<cbc:Name>", "</cbc:Name>", data$); tab( 30);
print dataBetween$( "<cbc:TaxableAmount currencyID=" +quotes$ +"EUR" +quotes$ +">", "</cbc:TaxableAmount>", data$),,
print dataBetween$( "<cbc:TaxAmount currencyID=" +quotes$ +"EUR" +quotes$ +">", "</cbc:TaxAmount>", data$),
invoiceCode$ =dataBetween$( "<cbc:InvoicedQuantity unitCode=" +quotes$, quotes$ +">1.00</cbc:InvoicedQuantity>", data$) if invoiceCode$ ="ZZ" then print dataBetween$( "<cbc:InvoicedQuantity unitCode=" +quotes$ +"ZZ" +quotes$ +">", "</cbc:InvoicedQuantity>", data$); tab( 90); else print dataBetween$( "<cbc:InvoicedQuantity unitCode=" +quotes$ +"EA" +quotes$ +">", "</cbc:InvoicedQuantity>", data$); tab( 90); end if
print dataBetween$( "<cbc:Percent>" , "</cbc:Percent>", data$), print dataBetween$( "<cbc:PriceAmount currencyID=" +quotes$ +"EUR" +quotes$ +">", "</cbc:PriceAmount>", data$) else e=nd end if
scan goto [look]
wait ' ___________________________________________________
function dataBetween$( start$, finish$, source$) S =instr( source$, start$) +len( start$) rightHand$ =mid$( source$, S) d$ =upto$( rightHand$, finish$) dataBetween$ =d$ end function
|
|
|
QR code
Aug 29, 2020 16:09:25 GMT -5
Post by tenochtitlanuk on Aug 29, 2020 16:09:25 GMT -5
This ( with rather careless column formatting and alignment) works fine. Do you have a file which has the variations of 'ZZ' and 'EA' to test?
start$ ="<cac:InvoiceLine>" lenS =len(start$) finish$ ="</cac:InvoiceLine>" lenF =len( finish$)
comma$ =chr$( 34)
open "UBLTest.xml" for input as #fIn file$ =input$( #fIn, lof( #fIn)) close #fIn
current = 1
print "Name"; tab( 30); "Taxable amount Tax amount Invoiced quantity Percent Price" PRINT ""
[look] pointer =instr( file$, start$, current) if pointer <>0 then endItem =instr( file$, finish$, pointer +2) data$ =mid$( file$, pointer +lenS , endItem -pointer -lenF) current =endItem print dataBetween$( "<cbc:Name>", "</cbc:Name>", data$); tab( 30); print dataBetween$( "<cbc:TaxableAmount currencyID=" +comma$ +"EUR" +comma$ +">", "</cbc:TaxableAmount>", data$),, print dataBetween$( "<cbc:TaxAmount currencyID=" +comma$ +"EUR" +comma$ +">", "</cbc:TaxAmount>", data$), print dataBetween$( "<cbc:InvoicedQuantity unitCode=" +comma$ +"ZZ" +comma$ +">", "</cbc:InvoicedQuantity>", data$); tab( 90); print dataBetween$( "<cbc:Percent>" , "</cbc:Percent>", data$), print dataBetween$( "<cbc:PriceAmount currencyID=" +comma$ +"EUR" +comma$ +">", "</cbc:PriceAmount>", data$) else e=nd end if
scan goto [look]
wait ' ___________________________________________________
function dataBetween$( start$, finish$, source$) S =instr( source$, start$) +len( start$) rightHand$ =mid$( source$, S) d$ =upto$( rightHand$, finish$) dataBetween$ =d$ end function
Output is..
Name Taxable amount Tax amount Invoiced quantity Percent Price
Artikel - Een - Hoog 100.00 21.00 1.00 21.00 100.00 Artikel - Twee - Hoog 200.00 42.00 1.00 21.00 200.00 Artikel - Drie - Hoog 300.00 63.00 1.00 21.00 300.00 Artikel - Vier - Hoog 400.00 84.00 1.00 21.00 400.00
|
|
|
QR code
Aug 29, 2020 15:12:04 GMT -5
Post by tenochtitlanuk on Aug 29, 2020 15:12:04 GMT -5
EDIT hadn't seen your latest post when I put this up- I'm rather busy at present- but glad to see you getting ahead with this project!!
Not sure where the UBL files come in But to get the bits out of the invoice 'blobs' you already have extracted, something like this works to extract the data you want.. basically defined a new function. Only trick isd realising to get double-quotes in a string you need to put it in as a chr$( 34)- see the Help files. start$ ="<cac:InvoiceLine>" lenS =len(start$) finish$ ="</cac:InvoiceLine>" lenF =len( finish$)
comma$ =chr$( 34)
open "source.ublinv" for input as #fIn file$ =input$( #fIn, lof( #fIn)) close #fIn
current = 1
[look] pointer =instr( file$, start$, current) if pointer <>0 then endItem =instr( file$, finish$, pointer +2) data$ =mid$( file$, pointer +lenS , endItem -pointer -lenF) current =endItem
print "Tax "; dataBetween$( "<cbc:TaxAmount currencyID=" +comma$ +"EUR" +comma$ +">", "</cbc:TaxAmount>", data$); " euros" print "Price "; dataBetween$( "<cbc:PriceAmount currencyID=" +comma$ +"EUR" +comma$ +">", "</cbc:PriceAmount>", data$); " euros" print "" else e=nd end if
scan goto [look]
wait ' ___________________________________________________
function dataBetween$( start$, finish$, source$) S =instr( source$, start$) +len( start$) rightHand$ =mid$( source$, S) d$ =upto$( rightHand$, finish$) dataBetween$ =d$ end function
..which produced the following off you example file ( note path and name changed for my debugging) Tax 21.00 euros Price 100.00 euros
Tax 42.00 euros Price 200.00 euros
Tax 63.00 euros Price 300.00 euros
Tax 84.00 euros Price 400.00 euros
|
|
|
Post by tenochtitlanuk on Aug 26, 2020 13:40:16 GMT -5
Sorry! I took what the web page said as being correct and working.. eg function GetCPUID (CoreMask: Word): PAnsiChar; stdcall; { Get the ID of the specified physical core }
Memo to self- don't believe everything you find on the 'net.
|
|
|
Post by tenochtitlanuk on Aug 26, 2020 3:12:38 GMT -5
|
|
|
Post by tenochtitlanuk on Aug 25, 2020 16:27:21 GMT -5
I used HardwareIDExtractorC.dll a decade ago in the example on my website. It doesn't seem to work on my current Linux/LB4.5 setup, but you could try it. Documented on the web...
|
|
|
Post by tenochtitlanuk on Aug 22, 2020 13:56:58 GMT -5
I'm not clear what you are trying to do. The following version writes an html page to a file and opens it in a web browser. I know however nothing about the meta tags..
nomainwin
PROJECTFILE$ ="pete.html" Q$ =chr$( 34)
open PROJECTFILE$ for output as #whtml
#whtml "<html>" #whtml "<meta charset=" +Q$ +"UTF-8" +Q$ +">" #whtml "<meta name=" +Q$ +"viewport" +Q$ +" content=" +Q$ +"width=device-width, initial-scale=1" +Q$ +"/>" #whtml "<meta name=" +Q$ +"bingbot" +Q$ +" content=" +Q$ +"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"+Q$+"/>" #whtml "<meta name=" +Q$ +"googlebot" +Q$ +" content=" +Q$ +"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1"+Q$+"/>" #whtml "<header>" #whtml "</header>" #whtml "<body bgcolor=" +Q$ +"C0C080" +Q$ +">" #whtml "<center>" #whtml "<h1>" #whtml "Heading" #whtml "</h1>" #whtml "</center>" #whtml "Sample text" #whtml "<p>" #whtml "<hr>" #whtml "</body>" #whtml "</html>"
close #whtml
run "explorer.exe pete.html"
end
|
|
|
Post by tenochtitlanuk on Aug 20, 2020 15:41:54 GMT -5
Your supplied code does not open a file or close it afterwards..
Try
nomainwin
open "Example.html" for output as #whtml
Q$=chr$(34) A$="<meta charset="+Q$+"UTF-8"+Q$+" >"
print #whtml,A$
close #whtml
It would be better practice to use the newer syntax- and remember the printing to file appends a CRLF UNLESS you put a semicolon at the end. If assembling html code strings this will help readability of the source file!
#whtml A$;
|
|
|
Post by tenochtitlanuk on Aug 5, 2020 2:56:44 GMT -5
Cundo- the texts are not translations but examples selected to have lots of vowels- see Rosetta Code examples.
Carl- I guessed my example would run. Was curious to know if, when the source text was KNOWN to be Unicode with multi-byte characters, it woud run in 5.. I'll have now to find some known Unicode files!!
|
|
|
Post by tenochtitlanuk on Aug 4, 2020 14:42:06 GMT -5
LB4's use of extended ASCII gives many accented characters.
I just noticed a Rosetta Code task to 'de-vowel' some supplied text. eg lineEnd$ =chr$( 13) +chr$( 10)
source$ ="Norwegian, Icelandic, German, Turkish, French, Spanish, English" +lineEnd$+_ "Undervisningen skal være gratis, i det minste på de elementære og grunnleggende trinn." +lineEnd$+_ "Hochschulunterricht muß allen gleichermaßen entsprechend ihren Fähigkeiten offenstehen." +lineEnd$+_ "Ögrenim hiç olmazsa ilk ve temel safhalarinda parasizdir. Ilk ögretim mecburidir." +lineEnd$+_ "L'éducation doit être gratuite, au moins en ce qui concerne l'enseignement élémentaire et fondamental." +lineEnd$+_ "La instrucción elemental será obligatoria. La instrucción técnica y profesional habrá de ser generalizada."+lineEnd$+_ "Education shall be free, at least in the elementary and fundamental stages." +lineEnd$ ... is turned to Nrwgn, clndc, Grmn, Trksh, Frnch, Spnsh, nglsh ndrvsnngn skl vr grts, dt mnst p d lmntr g grnnlggnd trnn. Hchschlntrrcht mß lln glchrmßn ntsprchnd hrn Fhgktn ffnsthn. grnm hç lmzs lk v tml sfhlrnd prszdr. lk grtm mcbrdr. L'dctn dt tr grtt, mns n c q cncrn l'nsgnmnt lmntr t fndmntl. L nstrccn lmntl sr blgtr. L nstrccn tcnc y prfsnl hbr d sr gnrlzd. dctn shll b fr, t lst n th lmntry nd fndmntl stgs.
Easy enough to write in LB4 with vowels defined as say "AEIOUIÖaeiouæáåäéêióöúÀÁÂÄÊËÌÍÖÙÚâêìíòóô"
I wonder how easy it'll be if Unicode multibyte characters are in the source string???
|
|
|
Post by tenochtitlanuk on Aug 1, 2020 14:06:47 GMT -5
|
|
|
Post by tenochtitlanuk on Jul 28, 2020 14:30:40 GMT -5
With the much improved turtle ( see my post 3 days ago) I'd find a function that returned current direction turtle is facing useful. Wouldn't then have to use my accurate simulated turtle....
|
|