Two files and one script...

I changed the script slightly.

Have fun...

Bill Hernandez
Plano, Texas

-- 
+---------+---------+---------+---------+---------+---------+---------+---------+
~/Desktop/bb_test/a.txt
-- 
+---------+---------+---------+---------+---------+---------+---------+---------+
Ham
Cheese
Tuna
Lettuce

-- 
+---------+---------+---------+---------+---------+---------+---------+---------+
~/Desktop/bb_test/b.txt
-- 
+---------+---------+---------+---------+---------+---------+---------+---------+
Salt
Pepper
Vodka
Tuna


-- 
+---------+---------+---------+---------+---------+---------+---------+---------+
-- script_name : a_minus_b.scpt
-- 
+---------+---------+---------+---------+---------+---------+---------+---------+
on run
        set a_path to (do shell script ("echo " & "~/Desktop/bb_test/a.txt"))
        set b_path to (do shell script ("echo " & "~/Desktop/bb_test/b.txt"))

        tell application "BBEdit"
                open (POSIX file a_path) as alias
                set a_props to get properties of text window 1
                set a_id to ID of a_props
                
                open (POSIX file b_path) as alias
                set b_props to get properties of text window 1
                set b_id to ID of b_props
                
                set myOptions to {search mode:grep, starting at top:true, wrap 
around:false, backwards:false, case sensitive:false, match words:true, extend 
selection:false}
                
                select text window id b_id
                set n to count lines of text of text window 1
                
                repeat with counter from 1 to n
                        select text window id b_id
                        select line counter of text of text window 1
                        set search_str to contents of selection
                        select text window id a_id
                        replace search_str using "" searching in text 1 of text 
window 1 options myOptions
                end repeat
                
        end tell
end run
-- 
+---------+---------+---------+---------+---------+---------+---------+---------+

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/bbedit?hl=en
If you have a feature request or would like to report a problem, 
please email "[email protected]" rather than posting to the group.

Reply via email to