Re: GREP help: dig into the report of the cash register

2018-12-06 Thread Christopher Stone
On 12/06/2018, at 11:30, m.osti mailto:mk0...@gmail.com>> 
wrote:
> of course, this way the result is even cleaner and easier then to use


Hey Marco,

Here's an updated script that produces cleaner output.

>From here I would probably turn the output into tab-delimited single lines.

Because from there it's easy to write a macro to extract the data and insert it 
into your web page one line at a time.

--
Best Regards,
Chris


# Auth: Christopher Stone
# dCre: 2018/12/04 16:04
# dMod: 2018/12/06 13:37
# Appl: BBEdit
# Task: Extract Cash Register Info.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Extract, @Cash, @Register, @Info, 
@BBEdit-Talk
# Vers: 1.01


set AppleScript's text item delimiters to ""

tell application "BBEdit"
tell front text window's text

replace "^\\h+EURO\\h*\\n" using "" options {search mode:grep, case 
sensitive:false, starting at top:true}
replace "^\\h+$" using "" options {search mode:grep, case 
sensitive:false, starting at top:true}
replace "\\n{2,}" using "\\n" options {search mode:grep, case 
sensitive:false, starting at top:true}
replace "^N\\.SCONTR\\.FISCALE.*" using "&\\n" options {search 
mode:grep, case sensitive:false, starting at top:true}
replace "\\A\\s+|\\s+\\Z" using "" options {search mode:grep, case 
sensitive:false, starting at top:true}

set docText to its text
set AppleScript's text item delimiters to linefeed & linefeed
set recordList to text items of docText

repeat with i in recordList
if contents of i does not contain "C.F." then
set contents of i to missing value
end if
end repeat

set recordList to (text of recordList) as text
set its text to recordList

replace "^(?>(?:(?!(?:t_fiscale|C\\.F\\.|\\d{2}-\\d{2}-\\d{4}|TOTALE 
EURO)).)*)$\\R?" using "" options {search mode:grep, case sensitive:false, 
starting at top:true}

replace "^t_fiscale" using "\\n&" options {search mode:grep, case 
sensitive:false, starting at top:true}
replace "\\A\\s+|\\s+\\Z" using "" options {search mode:grep, case 
sensitive:false, starting at top:true}

replace "^t_fiscale \\d{8} \\d{4} *" using "" options {search 
mode:grep, case sensitive:false, starting at top:true}
replace "^TOTALE EURO\\h+" using "" options {search mode:grep, case 
sensitive:false, starting at top:true}
replace "C\\.F\\.\\h*" using "" options {search mode:grep, case 
sensitive:false, starting at top:true}
replace "^(\\d{2}-\\d{2}-\\d{4})\\h+\\d{2}:\\d{2}" using "\\1" options 
{search mode:grep, case sensitive:false, starting at top:true}

select insertion point before it

end tell
end tell



-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: GREP help: dig into the report of the cash register

2018-12-06 Thread ThePorgie
Right you are. I didn't notice that when I last tested. Try this:
t_fiscale (\d{4})(\d{2})(\d{2}) (\d+) (\d+)$(?:.*\n){1,8}?TOTALE EURO 
+([0-9,]+)(?:.*\n){1,3}?C\.F\. +([\w]+)

and replace:
\5\n\3/\2/\1\n\6\n\7\n\n

Note: I'm not sure how many items you can have listed on your receipt which 
causes me pause even with this grep string as 1 receipt with a long list 
will get skipped. I couldn't come up with a way to stop the greedy over-run 
if the string didn't contain the "C.F" line. If someone else notices 
something in this regard that I overlooked that would be great.


On Thursday, December 6, 2018 at 12:27:43 PM UTC-5, m.osti wrote:
>
> thank you for your concern. this GREP search is quite good: it get also 
> the sale(s) without CF that are unnecessary but I can just ignore them at a 
> fast glance.
>
> Il giorno mercoledì 5 dicembre 2018 18:20:28 UTC+1, ThePorgie ha scritto:
>>
>> I see you've got a script, but I like a puzzle... seems to work like this.
>>
>> t_fiscale (\d{4})(\d{2})(\d{2}) (\d+) (\d+)$(?s).+?TOTALE EURO 
>> +([0-9,]+).+?C\.F\. +([\w,]+)
>>
>> I used this with the extract option
>>
>>
>> On Tuesday, December 4, 2018 at 8:14:34 AM UTC-5, m.osti wrote:
>>>
>>> Hello, every day when I have to close up my shop I get this report from 
>>> the cash register. I have the obligation to transmit some sales data 
>>> through a web page, and I have to insert one receipt at a time, sigh.
>>> Only sales that have the "C.F." are valid.
>>> In this case I need it in the order:
>>> the date
>>> the receipt number
>>> the total euro
>>> the alphanumeric part after C.F. for example ABCDEF12G34H567I which is 
>>> of 16 characters always in this order 6 alphabetic characters, 2 numbers, 1 
>>> character, 2 numbers, 1 character, 3 numbers, 1 character.
>>>
>>> Now I copy them by hand and then I use a macro that I created in 
>>> KeyboardMaestro. Since there is a lot of data that I don't need, to speed 
>>> up I tried to extract only the necessary values through a GREP search, but 
>>> I failed, failed, failed and after many attempts I decided to ask.
>>> If it were possible I would also like the date separator to be / instead 
>>> of -
>>>
>>> I'm going to put on the cash register closure below: the values I need 
>>> are in red.
>>> Thank you and sorry for my english.
>>> ciao from italy
>>>
>>> -m
>>>
>>> ---
>>>
>>> t_fiscale 20170422 0846 *1*
>>>   EURO  
>>> LENTI OFT 110,00
>>> MONTAGGIO LENTI20,00
>>> TOTALE EURO   *130,00*
>>> CONTANTE  130,00
>>> C.F.   *ABCDEF12G34H567I* 
>>> 
>>> CASSA:01
>>> *22-04-2017* 08:46
>>> N.SCONTR.FISCALE   1
>>> t_fiscale 20170422 0936 *2*
>>>   EURO  
>>> LENTI CONTATTO100,00
>>> TOTALE EURO   *100,00*
>>> CONTANTE  100,00
>>> C.F.   *ABCDEF12G34H567I* 
>>> 
>>> CASSA:01
>>> 22-04-2017 09:36
>>> N.SCONTR.FISCALE   2
>>> t_fiscale 20170422 1037 *3*
>>>   EURO  
>>> MONTATURE OFT 120,00
>>> LENTI OFT 120,00
>>> MONTAGGIO LENTI20,00
>>> TOTALE EURO   *260,00*
>>> CONTANTE  260,00
>>> C.F.   *LMNOPQ89R01S234T* 
>>> 
>>> CASSA:01
>>> 22-04-2017 10:37
>>> N.SCONTR.FISCALE   3
>>> t_fiscale 20170422 1055 4
>>>   EURO  
>>> IVA 22  8,00
>>> TOTALE EURO 8,00
>>> CONTANTE8,00
>>> 
>>> CASSA:01
>>> 22-04-2017 10:55
>>> N.SCONTR.FISCALE   4
>>> t_fiscale 20170422 1826 *5*
>>>   EURO  
>>> SOLUZIONI LAC  23,00
>>> TOTALE EURO23,00
>>> CONTANTE   *23,00*
>>> C.F.   *LMNOPQ89R01S234T* 
>>> 
>>> CASSA:01
>>> 22-04-2017 18:26
>>> N.SCONTR.FISCALE   5
>>> t_non fiscale 20170422 1843 1
>>>   NON FISCALE   
>>> RAPPORTO REPARTI "Z" 
>>>  PERIODICO 1 
>>> *(++ BELOW UNNECESSARY DATA ++)*
>>> DATA ULTIMO AZZERAMENTO  
>>>21-04-2017
>>> 
>>> CASSA:01
>>> 22-04-2017 18:43
>>> N.SCONTR.NON FISC  1
>>>   NON FISCALE   
>>> t_fiscale 20170422 1843 6
>>>   RAPPORTO *Z*  
>>> CHIUSURA FISCALE
>>>   DATI IN EURO  
>>> 
>>> 
>>>  CORRISPETTIVI  
>>>SCONTRINI
>>> 
>>> CORRISP. GIORNALIERI
>>> 1 234,00
>>> PROGR. CORRISPETTIVI
>>>   123 456,78
>>> NOTE DI CREDITO GIORN.  
>>> 0,00
>>> 
>>> 
>>>  CORRISPETTIVI  
>>> DOCUMENTI CL.II 
>>> 
>>> CORRISP. GIORNALIERI
>>> 0,00
>>> *FATTURE0,00
>>> *RICEVUTE   0,00
>>> NOTE DI 

Re: GREP help: dig into the report of the cash register

2018-12-06 Thread m.osti
with this option there is an error: it get sales #4 (sale without CF = 
unnecessary) but it ignore sale #5 (with CF = necessary)
of course, this way the result is even cleaner and easier then to use

Il giorno mercoledì 5 dicembre 2018 18:25:36 UTC+1, ThePorgie ha scritto:
>
>
> oops...you might need the replace info
> \5\n\1/\2/\3\n\6\n\7
>
>
> On Wednesday, December 5, 2018 at 12:20:28 PM UTC-5, ThePorgie wrote:
>>
>> I see you've got a script, but I like a puzzle... seems to work like this.
>>
>> t_fiscale (\d{4})(\d{2})(\d{2}) (\d+) (\d+)$(?s).+?TOTALE EURO 
>> +([0-9,]+).+?C\.F\. +([\w,]+)
>>
>> I used this with the extract option
>>
>
ohh yess,  that also works! kudos
thank you

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


Re: GREP help: dig into the report of the cash register

2018-12-06 Thread m.osti
thank you for your concern. this GREP search is quite good: it get also the 
sale(s) without CF that are unnecessary but I can just ignore them at a 
fast glance.

Il giorno mercoledì 5 dicembre 2018 18:20:28 UTC+1, ThePorgie ha scritto:
>
> I see you've got a script, but I like a puzzle... seems to work like this.
>
> t_fiscale (\d{4})(\d{2})(\d{2}) (\d+) (\d+)$(?s).+?TOTALE EURO 
> +([0-9,]+).+?C\.F\. +([\w,]+)
>
> I used this with the extract option
>
>
> On Tuesday, December 4, 2018 at 8:14:34 AM UTC-5, m.osti wrote:
>>
>> Hello, every day when I have to close up my shop I get this report from 
>> the cash register. I have the obligation to transmit some sales data 
>> through a web page, and I have to insert one receipt at a time, sigh.
>> Only sales that have the "C.F." are valid.
>> In this case I need it in the order:
>> the date
>> the receipt number
>> the total euro
>> the alphanumeric part after C.F. for example ABCDEF12G34H567I which is of 
>> 16 characters always in this order 6 alphabetic characters, 2 numbers, 1 
>> character, 2 numbers, 1 character, 3 numbers, 1 character.
>>
>> Now I copy them by hand and then I use a macro that I created in 
>> KeyboardMaestro. Since there is a lot of data that I don't need, to speed 
>> up I tried to extract only the necessary values through a GREP search, but 
>> I failed, failed, failed and after many attempts I decided to ask.
>> If it were possible I would also like the date separator to be / instead 
>> of -
>>
>> I'm going to put on the cash register closure below: the values I need 
>> are in red.
>> Thank you and sorry for my english.
>> ciao from italy
>>
>> -m
>>
>> ---
>>
>> t_fiscale 20170422 0846 *1*
>>   EURO  
>> LENTI OFT 110,00
>> MONTAGGIO LENTI20,00
>> TOTALE EURO   *130,00*
>> CONTANTE  130,00
>> C.F.   *ABCDEF12G34H567I* 
>> 
>> CASSA:01
>> *22-04-2017* 08:46
>> N.SCONTR.FISCALE   1
>> t_fiscale 20170422 0936 *2*
>>   EURO  
>> LENTI CONTATTO100,00
>> TOTALE EURO   *100,00*
>> CONTANTE  100,00
>> C.F.   *ABCDEF12G34H567I* 
>> 
>> CASSA:01
>> 22-04-2017 09:36
>> N.SCONTR.FISCALE   2
>> t_fiscale 20170422 1037 *3*
>>   EURO  
>> MONTATURE OFT 120,00
>> LENTI OFT 120,00
>> MONTAGGIO LENTI20,00
>> TOTALE EURO   *260,00*
>> CONTANTE  260,00
>> C.F.   *LMNOPQ89R01S234T* 
>> 
>> CASSA:01
>> 22-04-2017 10:37
>> N.SCONTR.FISCALE   3
>> t_fiscale 20170422 1055 4
>>   EURO  
>> IVA 22  8,00
>> TOTALE EURO 8,00
>> CONTANTE8,00
>> 
>> CASSA:01
>> 22-04-2017 10:55
>> N.SCONTR.FISCALE   4
>> t_fiscale 20170422 1826 *5*
>>   EURO  
>> SOLUZIONI LAC  23,00
>> TOTALE EURO23,00
>> CONTANTE   *23,00*
>> C.F.   *LMNOPQ89R01S234T* 
>> 
>> CASSA:01
>> 22-04-2017 18:26
>> N.SCONTR.FISCALE   5
>> t_non fiscale 20170422 1843 1
>>   NON FISCALE   
>> RAPPORTO REPARTI "Z" 
>>  PERIODICO 1 
>> *(++ BELOW UNNECESSARY DATA ++)*
>> DATA ULTIMO AZZERAMENTO  
>>21-04-2017
>> 
>> CASSA:01
>> 22-04-2017 18:43
>> N.SCONTR.NON FISC  1
>>   NON FISCALE   
>> t_fiscale 20170422 1843 6
>>   RAPPORTO *Z*  
>> CHIUSURA FISCALE
>>   DATI IN EURO  
>> 
>> 
>>  CORRISPETTIVI  
>>SCONTRINI
>> 
>> CORRISP. GIORNALIERI
>> 1 234,00
>> PROGR. CORRISPETTIVI
>>   123 456,78
>> NOTE DI CREDITO GIORN.  
>> 0,00
>> 
>> 
>>  CORRISPETTIVI  
>> DOCUMENTI CL.II 
>> 
>> CORRISP. GIORNALIERI
>> 0,00
>> *FATTURE0,00
>> *RICEVUTE   0,00
>> NOTE DI CREDITO GIORN.  
>> 0,00
>> 
>> 
>>DETTAGLIO
>>OPERAZIONI   
>> 
>> SCONTI  0,00
>>   N.0   
>> MAGGIORAZ.  0,00
>>   N.0   
>> BONIFICI0,00
>>   N.0   
>> RETTIFICHE  0,00
>>   N.0   
>> CORRISP. NON RISCOSSI   
>> *SCONTRINI  0,00
>> *RICEVUTE   0,00
>> CORRISP. RISCOSSI   
>> *SCONTRINI  1 234,00
>> *FATTURE0,00
>> *RICEVUTE   0,00
>> 
>> 
>>DOCUMENTI
>>   GIORNALIERI   
>> 
>> N.SCONTR.FISCALI   6
>> *N.SCONTR./NOTE 

Re: BBEdit 12.5.1 failed to "show invisibles"

2018-12-06 Thread Bruce Linde
problems should be reported to supp...@barebones.com





On Thursday, December 6, 2018 at 9:56:25 AM UTC-5, Dawn Song wrote:
>
> When I check "View" > "Text Display" > "Show Invisibles", BBEdit failed to 
> show the invisible symbol between "hybrid=1" and "=7".
> It works before.
>

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.


BBEdit 12.5.1 failed to "show invisibles"

2018-12-06 Thread Dawn Song
When I check "View" > "Text Display" > "Show Invisibles", BBEdit failed to 
show the invisible symbol between "hybrid=1" and "=7".
It works before.

-- 
This is the BBEdit Talk public discussion group. If you have a 
feature request or need technical support, please email
"supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: 
--- 
You received this message because you are subscribed to the Google Groups 
"BBEdit Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
To post to this group, send email to bbedit@googlegroups.com.
Visit this group at https://groups.google.com/group/bbedit.
https://pages.lazada.com.my/wow/camp/my/1212/topselling?itemId=363660867=1​=7