On 12/06/2018, at 11:30, m.osti <[email protected] <mailto:[email protected]>> 
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
"[email protected]" rather than posting to the group.
Follow @bbedit on Twitter: <https://www.twitter.com/bbedit>
--- 
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 [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/bbedit.

Reply via email to