AppleScript to delete the whole line if ..
Im using the following code to find and replace with "target word" but I would like to DELETE the whole line instead of replacing the actual word.
so it would be
if the line contains www.network -> Delete the whole line.
Thanks in advance!
set theTargetWords to {"www.network"}
tell application "Pages" to activate
tell application "System Events" to tell process "Pages"
-- Open the "Find & Replace" window:
keystroke "f" usingcommand down
repeat until exists window "Find & Replace"
end repeat
tell tab group 1 of window "Find & Replace"
-- Adjust the settings:
clickradio button 2 -- Advanced
if value of checkbox 2 is 1 then click checkbox 2 -- Don't match case
if value of checkbox 3 is 1 then click checkbox 3 -- Whole words
if value of checkbox 1 is 0 then clickcheckbox 1 -- Search previous text (loop)
clickpop up button 1 -- find in
clickmenu item 1 of menu 1 of pop up button 1 -- Entire document
clickpop up button 2 -- replace style
clickmenu item 1 of menu 1 of pop up button 2 -- Any
-- Delete every target word:
set value of text area 1 of scroll area 2 to ""
repeat with thisWord in theTargetWords
set value of text area 1 of scroll area 1 to thisWord -- the target word
click button "Replace All"
end repeat
end tell
end tell
AppleScript