• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
BBEdit Repeating Finds
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

BBEdit Repeating Finds


  • Subject: BBEdit Repeating Finds
  • From: "EUROPE/SWAIN" <email@hidden>
  • Date: Thu, 10 Apr 2003 23:02:34 +0100

Hi,
I have a large text file (>50 MB) containing multiple records each of which
needs editing. The format of the file is
Record 1 text
$$$$
Record 2 text
$$$$
Record 3 text
etc
The script below finds the first record, edits the text and creates a new
file, but I can't work out how to get it to do it for subsequent records.
Thanks in anticipation
Chris


on run
set TheFile to (choose file with prompt "Choose a file to modify")
CheckFile(TheFile) of me
end run
on CheckFile(TheFile)
set line_start to 1
tell application "BBEdit"
activate
open TheFile
set search_results to (find "$$$$" searching in text 1 of text window 1
options {search mode:literal, starting at top:true, wrap around:false,
reverse:false, case sensitive:false, match words:false, extend
selection:false} with selecting match)
set more_to_do to found of search_results
set line_end to startLine of selection
--display dialog more_to_do
--display dialog line_start
--display dialog line_end
if more_to_do is true then
tell text window 1
select (lines line_start through line_end)
set next_record to selection as text
--set new_record munge next_record (this bit edits the text and is omitted
for clarity)
end tell
set line_start to line_end
end if
--display dialog record_list
if more_to_do = true then
make new window with properties {name:"new_file"}
tell text window 1
select insertion point after last character
set selection to new_record
--save to file "Macintosh HD:Users:username:Desktop:junk"
--close
end tell
end if
--quit
end tell
end CheckFile



------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, contains information of Merck & Co., Inc. (Whitehouse Station, New Jersey, USA) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named in this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it.

==============================================================================
_______________________________________________
applescript-users mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-users
Do not post admin requests to the list. They will be ignored.

  • Prev by Date: Re: (no subject)
  • Next by Date: Re: Eudora Settings (was Re: (no subject))
  • Previous by thread: Scripting print dialog in Preview
  • Next by thread: Mounting Windows Drives
  • Index(es):
    • Date
    • Thread