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

2018-12-14 Thread m.osti
Hi Chris, thank you for the support ;) 

> I can write another script that will parse these into variables that can 
be inserted into your web page.

This is over my skill Chris :( but for your information, I have to put 
other data in 3 consecutive web pages. I set up 2 macros with Keyboad 
Maestro: the 1st just copy (clic & drag to select) the 4 row: receipt 
number, date, amount, cf, and put them all into the related variables. then 
it switch to chrome and calls the second one macro. Not so elegant, nor 
fully automated, but it's fast and safe and I can check it easily. as 
always sry for my english.

Il giorno venerdì 7 dicembre 2018 11:21:49 UTC+1, Christopher Stone ha 
scritto:
>
> On 12/06/2018, at 13:44, Christopher Stone  > wrote:
>
> Here's an updated script that produces cleaner output.
> From here I would probably turn the output into tab-delimited single lines.
>
> --
>
> Hey Marco,
>
> The newest incarnation of the script (appended) produces output like this:
>
> 1 130,00 ABCDEF12G34H567I 22-04-2017
> 2 100,00 ABCDEF12G34H567I 22-04-2017
> 3 260,00 LMNOPQ89R01S234T 22-04-2017
> 5 23,00 LMNOPQ89R01S234T 22-04-2017
>
> I can write another script that will parse these into variables that can 
> be inserted into your web page.
>
> Each pass will show a line item as processed like so:
>
> [✓] 1 130,00 ABCDEF12G34H567I 22-04-2017
>
> If you set the windows of your web browser and BBEdit up just so, you can 
> get realtime visual feedback on each pass.
>
> --
> Best Regards,
> Chris
>
> 
> # Auth: Christopher Stone
> # dCre: 2018/12/04 16:04
> # dMod: 2018/12/07 02:43
> # Appl: BBEdit
> # Task: Extract Cash Register Info.
> # Libs: None
> # Osax: None
> # Tags: @Applescript, @Script, @BBEdit, @Extract, @Cash, @Register, @Info, 
> @BBEdit-Talk
> # Vers: 1.02
> 
>
> *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* "\\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*}
> *replace* "(?<=\\w)\\R(?=\\w)" using "\\t" options {search mode:
> *grep*, case sensitive:*false*, starting at top:*true*}
> *replace* "^$\\R" using "" 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 

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

2018-12-14 Thread m.osti
Hi, I tried this also and seems to me the result is the same as the 
previous one: perfect.
I use the multi search function of bbedit: it scans all the folders 
containing the files (one per day) and in 4 seconds extracts all the data. 
awesome!

Ah, there was only a receipt with an amount of 1000,00 and the script 
extracts just "1", same for the previous script as well. I saw it 
immediately because it was without ", 00" so no problem.
Here it is:
5
02/10/2018
1
MCCGLC87A49V111R

Thank you again, you save me a lot of time, of very boring time ;)

Il giorno venerdì 7 dicembre 2018 15:37:47 UTC+1, ThePorgie ha scritto:
>
> Ok, I think I've narrowed down the greedy over-run to only look between 
> matching register numbers...So basically this should work regardless of 
> varying number of item lines in your receipt.
>
> Search:
> t_fiscale (\d{4})(\d{2})(\d{2}) (\d+) (\d+)$(?s).*?TOTALE EURO 
> +([0-9,]+).*?C\.F\. +([\w]+).*?N\.SCONTR\.FISCALE +\5
>
> Replace:
> \5\n\3/\2/\1\n\6\n\7\n\n
>
> On Friday, December 7, 2018 at 4:03:26 AM UTC-5, m.osti wrote:
>>
>> Well ThePorgie, not sure to have understood your note but... now it's 
>> perfect.
>> thank you
>>
>> Il giorno giovedì 6 dicembre 2018 19:33:55 UTC+1, ThePorgie ha scritto:
>>>
>>> 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  

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

2018-12-07 Thread ThePorgie
Ok, I think I've narrowed down the greedy over-run to only look between 
matching register numbers...So basically this should work regardless of 
varying number of item lines in your receipt.

Search:
t_fiscale (\d{4})(\d{2})(\d{2}) (\d+) (\d+)$(?s).*?TOTALE EURO 
+([0-9,]+).*?C\.F\. +([\w]+).*?N\.SCONTR\.FISCALE +\5

Replace:
\5\n\3/\2/\1\n\6\n\7\n\n

On Friday, December 7, 2018 at 4:03:26 AM UTC-5, m.osti wrote:
>
> Well ThePorgie, not sure to have understood your note but... now it's 
> perfect.
> thank you
>
> Il giorno giovedì 6 dicembre 2018 19:33:55 UTC+1, ThePorgie ha scritto:
>>
>> 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  
>

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

2018-12-07 Thread Christopher Stone
On 12/06/2018, at 13:44, Christopher Stone mailto:listmeis...@suddenlink.net>> wrote:
> Here's an updated script that produces cleaner output.
> From here I would probably turn the output into tab-delimited single lines.


Hey Marco,

The newest incarnation of the script (appended) produces output like this:

1   130,00  ABCDEF12G34H567I22-04-2017
2   100,00  ABCDEF12G34H567I22-04-2017
3   260,00  LMNOPQ89R01S234T22-04-2017
5   23,00   LMNOPQ89R01S234T22-04-2017

I can write another script that will parse these into variables that can be 
inserted into your web page.

Each pass will show a line item as processed like so:

[✓] 1   130,00  ABCDEF12G34H567I22-04-2017

If you set the windows of your web browser and BBEdit up just so, you can get 
realtime visual feedback on each pass.

--
Best Regards,
Chris


# Auth: Christopher Stone
# dCre: 2018/12/04 16:04
# dMod: 2018/12/07 02:43
# Appl: BBEdit
# Task: Extract Cash Register Info.
# Libs: None
# Osax: None
# Tags: @Applescript, @Script, @BBEdit, @Extract, @Cash, @Register, @Info, 
@BBEdit-Talk
# Vers: 1.02


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 "\\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}
replace "(?<=\\w)\\R(?=\\w)" using "\\t" options {search mode:grep, 
case sensitive:false, starting at top:true}
replace "^$\\R" using "" 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-07 Thread m.osti
Well ThePorgie, not sure to have understood your note but... now it's 
perfect.
thank you

Il giorno giovedì 6 dicembre 2018 19:33:55 UTC+1, ThePorgie ha scritto:
>
> 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 

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: GREP help: dig into the report of the cash register

2018-12-05 Thread ThePorgie

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
>
>
> 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 CRED.  0
>> N.SCONTR.N FISCALI 1
>> *N.RAPP.LETTURE DGFE   0
>> 
>> N.DOCUMENTI 

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

2018-12-05 Thread ThePorgie
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 CRED.  0
> N.SCONTR.N FISCALI 1
> *N.RAPP.LETTURE DGFE   0
> 
> N.DOCUMENTI CL.II  0
> *N.FATTURE 0
> *N.FATTURE/NOTE CRED.  0
> *N.RICEVUTE0
> 
> 
>  DATI GENERALI  
> 
> N.LETT.MEM.FISCALE 0
> 
> PROGR. AZZERAMENTI   960
> NUM. 

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

2018-12-05 Thread @lbutlr
On Tue Dec 04 2018 03:19:02 m.osti   said:
> 
> 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 -

The grep for the date is pretty straightforward, since you can match on 
# and I assume that the date is going to be the same on all the 
transactions. So grab the date and deal with the amount and CF separately.

It should be possible to setup a grep that looks for

fiscal[stuff](date)(number)[end of line][anystuff] EURO (numbers a comma 
numbers)[end of line][anystuff]C.F.[spaces](alphanumerics)[space][endofline]

\1 contains your date, and you can format it however you want ()(..)(..) 
gives you  mm dd
\2 contains your (transaction) number
\3 the Euro amount
\4 the C.F. ID

If you have a scanner that supports OCR (including an iOS app), scanning the 
receipts and putting them somewhere on your computer means that Hazel would be 
able to process the recipes automatically. Add an AppleScript and you can 
probably automate the submission to your web portal.

(It would take me a long time to build the actual grep, but basically the idea 
is there and some playing with it will yield something that works)

-- 
'He's mad, isn't he?' 'No, mad's when you froth at the mouth,' said
Gaspode. ' He's insane. That's when you froth at the brain.’





-- 
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-05 Thread m.osti


Il giorno martedì 4 dicembre 2018 21:41:43 UTC+1, David Wagner ha scritto:
>
> You state what you need is in red, but you do not show any date in red. 
> Please clarify...
>

Sorry Wags, it's cause I'm on google groups via web browser, and it allows 
HTML view.
Below the picture.
ty
-m

[image: Schermata 2018-12-05 alle 09.23.59.png]
 

-- 
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-05 Thread m.osti


Il giorno martedì 4 dicembre 2018 23:12:49 UTC+1, Christopher Stone ha 
scritto:
>
> On 12/04/2018, at 04:19, 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.
>
> --
>
> Hey M.,
>
> This is a bit of a sticky problem, so I'm not surprised you had problems 
> when relying on grep alone.
>
> Run this AppleScript from the Applescript Editor against your register 
> tape in BBEdit.
>
> I believe I've extracted the relevant data from the tape.
>

Thank you Chris, this just _works_ !!!
You scripters save my life from time to time :)
-m

-- 
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-04 Thread Christopher Stone
On 12/04/2018, at 04:19, m.osti mailto:mk0...@gmail.com>> 
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.


Hey M.,

This is a bit of a sticky problem, so I'm not surprised you had problems when 
relying on grep alone.

Run this AppleScript from the Applescript Editor against your register tape in 
BBEdit.

I believe I've extracted the relevant data from the tape.  If so then we need 
another pass to get just the values you want.

>From there it shouldn't be hard to pop those values into Keyboard Maestro 
>variables for insertion into your web page.

--
Best Regards,
Chris


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


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}

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-04 Thread David G Wagner
You state what you need is in red, but you do not show any date in red. Please 
clarify...

thank you...

Wags ;)
WagsWorld
Hebrews 4:15
Ph(primary) : 408-914-1341
Ph(secondary): 408-761-7391
On Dec 4, 2018, 05:14 -0800, 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 LENTI    20,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 CONTATTO    100,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 LENTI    20,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
> CONTANTE            8,00
>
> CASSA:                01
> 22-04-2017         10:55
> N.SCONTR.FISCALE       4
> t_fiscale 20170422 1826 5
>                   EURO
> SOLUZIONI LAC      23,00
> TOTALE EURO        23,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
> *FATTURE            0,00
> *RICEVUTE           0,00
> NOTE DI CREDITO GIORN.
>                     0,00
>
> 
>        DETTAGLIO
>        OPERAZIONI
> 
> SCONTI              0,00
>       N.    0
> MAGGIORAZ.          0,00
>       N.    0
> BONIFICI            0,00
>       N.    0
> RETTIFICHE          0,00
>       N.    0
> CORRISP. NON RISCOSSI
> *SCONTRINI          0,00
> *RICEVUTE           0,00
> CORRISP. RISCOSSI
> *SCONTRINI      1 234,00
> *FATTURE            0,00
> *RICEVUTE           0,00
>
> 
>        DOCUMENTI
>       GIORNALIERI
> 
> N.SCONTR.FISCALI       6
> *N.SCONTR./NOTE CRED.  0
> N.SCONTR.N FISCALI     1
> *N.RAPP.LETTURE DGFE   0
>
> N.DOCUMENTI CL.II      0
> *N.FATTURE             0
> *N.FATTURE/NOTE CRED.  0
> *N.RICEVUTE            0
>
> 
>      DATI GENERALI
> 
> N.LETT.MEM.FISCALE     0
>
> PROGR. AZZERAMENTI   960
> NUM. RIPRISTINI        0
>
> 
> DISPOS.GIORN.ELETTRONICO
>       N.2 DEL 02-05-2014
>        MATR. 05 30005163
>
> CASSA:                01
> 22-04-2017         18:43
> N.SCONTR.FISCALE       6
>
> --
> 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 

GREP help: dig into the report of the cash register

2018-12-04 Thread m.osti
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 CRED.  0
N.SCONTR.N FISCALI 1
*N.RAPP.LETTURE DGFE   0

N.DOCUMENTI CL.II  0
*N.FATTURE 0
*N.FATTURE/NOTE CRED.  0
*N.RICEVUTE0


 DATI GENERALI  

N.LETT.MEM.FISCALE 0

PROGR. AZZERAMENTI   960
NUM. RIPRISTINI0


DISPOS.GIORN.ELETTRONICO
  N.2 DEL 02-05-2014
   MATR. 05 30005163

CASSA:01
22-04-2017 18:43
N.SCONTR.FISCALE   6

-- 
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