|
Post by tenochtitlanuk on Sept 27, 2020 15:50:52 GMT -5
Have added second page showing how to make a stylophone-type mouse operated keyboard with your own tones pre-generated.
|
|
|
QR code
Sept 27, 2020 15:47:16 GMT -5
Post by tenochtitlanuk on Sept 27, 2020 15:47:16 GMT -5
Congratulations on getting so far with a program that does something commercially useful to you! Don't have much time at present to look at the code or what you want to do next- but keep us in touch with developments!
|
|
|
Post by tenochtitlanuk on Sept 23, 2020 15:05:05 GMT -5
This cropped up recently on JB Forum.
We already have excellent code from the Watsons ( thanks Thomas and Alyce) from two decades ago. I've just created a page and graphics to show how it works, at WAV file creation for anyone else looking to code and display/listen to novel sounds!
|
|
|
Post by tenochtitlanuk on Sept 22, 2020 9:55:02 GMT -5
/home/john/LBandJB/lb5x64-351/lb5alpha-351 on Linux Unhandled exception: URL not found......
but works under Wine
|
|
|
Post by tenochtitlanuk on Sept 22, 2020 5:39:58 GMT -5
Can you give an example URL where it gives this error? It works for me on LB4.5.1 on htpp and https sites...
print httpget$("http://www.diga.me.uk/index.html") print "_________________________________________________" print httpget$("https://www.bbc.co.uk/weather/2654675")
EDIT It fails in LB5- which is only an ALPHA version...
|
|
|
Post by tenochtitlanuk on Sept 13, 2020 10:04:20 GMT -5
Works fine for me on LB4.5. Is file #whtml opened correctly for output?
|
|
|
QR code
Sept 2, 2020 8:43:43 GMT -5
Post by tenochtitlanuk on Sept 2, 2020 8:43:43 GMT -5
I'm sure we can cope for an added line feed. Can you load the file in a hex editor and find whether it is a CR, a LF, a CRLF pair, and are there extra spaces? I'm worried that we are 'reverse engineering' files. We don't know what the file specification is, so there may be further surprises in store! Writing a version of an existing xml file with new values is in itself easy. Code below has been provided with code snippets numbers 1 2 and 3, and inserts text- or numeric changed to text string form- between them. NB not real xml code.
name$ ="GIF" '"JPG" offset =0 '666
open "newXml.xml" for output as #fOut open "xmlSamplePart1.xml" for input as #fIn i$( 1) =input$( #fIn, lof( #fIn)) close #fIn
open "xmlSamplePart2.xml" for input as #fIn i$( 2) =input$( #fIn, lof( #fIn)) close #fIn
open "xmlSamplePart3.xml" for input as #fIn i$( 3) =input$( #fIn, lof( #fIn)) close #fIn
whole$ =i$( 1) +name$ +i$( 2) +str$( offset) +i$( 3) #fOut whole$; print whole$
close #fOut
Produces <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE magicmap>
<magicmap> <!-- <magic name="GIF" offset="0" target="GIF8"/> --> </magicmap>
... and altering the two data items, file now has JPG and 666 replacing GIF and 0.
|
|
|
QR code
Sept 1, 2020 16:39:37 GMT -5
Post by tenochtitlanuk on Sept 1, 2020 16:39:37 GMT -5
Can you try this variant? I THINK it covers the EA/ZZ and InvoicedQuantity versions. Added number count, and the code EA/ZZ. You'd be storing values in your arrays, not printing, of course. Change file name appropriately.. I know NOTHING of xml. But LB will happily write values into a text file called jack.xml if you DO understand it!
start$ ="<cac:InvoiceLine>" lenS =len(start$) finish$ ="</cac:InvoiceLine>" lenF =len( finish$)
quotes$ =chr$( 34)
itemNumber =0
open "UBLTestEAZZb.xml" for input as #fIn file$ =input$( #fIn, lof( #fIn)) close #fIn
current = 1
print "File entry # Name"; tab( 38); "Taxable amount Tax amount Invoiced quantity Percent Price" PRINT ""
[look] pointer =instr( file$, start$, current) if pointer <>0 then itemNumber =itemNumber +1
endItem =instr( file$, finish$, pointer +2) data$ =mid$( file$, pointer +lenS , endItem -pointer -lenF) current =endItem
print right$( " " +str$( itemNumber), 4),
print dataBetween$( "<cbc:Name>", "</cbc:Name>", data$); tab( 40);
print dataBetween$( "<cbc:TaxableAmount currencyID=" +quotes$ +"EUR" +quotes$ +">", "</cbc:TaxableAmount>", data$),
print dataBetween$( "<cbc:TaxAmount currencyID=" +quotes$ +"EUR" +quotes$ +">", "</cbc:TaxAmount>", data$),
' _______________________________________________________________________________________________________________________________ 'PROBLEM old syntax <cbc:InvoicedQuantity unitCode="ZZ">1.00</cbc:InvoicedQuantity> with EA or ZZ ' ^ ^ ' but alternative syntax <cbc:InvoicedQuantity unitCodeListID="UNECERec20" unitCode="EA">1.00</cbc:InvoicedQuantity> ' ^ ^ Code$ =dataBetween$( "<cbc:InvoicedQuantity ", quotes$ +">", data$) invoiceCode$ =right$( Code$, 2)
I$ = dataBetween$( quotes$ +">", "</", dataBetween$( "<cbc:InvoicedQuantity ", "</cbc:InvoicedQuantity>", data$)) 'I$ = print I$; tab( 90);
' _______________________________________________________________________________________________________________________________
print dataBetween$( "<cbc:Percent>" , "</cbc:Percent>", data$), print dataBetween$( "<cbc:PriceAmount currencyID=" +quotes$ +"EUR" +quotes$ +">", "</cbc:PriceAmount>", data$), print invoiceCode$ else end 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
|
|
|
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.
|
|