Skip to content

Instantly share code, notes, and snippets.

@rwilcox
Created June 17, 2014 13:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwilcox/e407ebdd2ed569f685f8 to your computer and use it in GitHub Desktop.
Save rwilcox/e407ebdd2ed569f685f8 to your computer and use it in GitHub Desktop.
Start find from top in BBEdit
(*
This Applescript lets you do a search starting at the top of the current document, NOT where the cursor is currently positioned
Author: Ryan Wilcox
Date: June 17, 2014
License: Public Domain
*)
property oldSearchString : "fish"
tell application "BBEdit"
set res to display dialog "search current document for?" default answer oldSearchString
if button returned of res is "OK" then
set searchOpt to get current search options
set searchOpt's starting at top to true
set oldSearchString to text returned of res
tell window 1
set findRes to find (text returned of res) options searchOpt with selecting match
if findRes's found is false then
display dialog "not found"
end if
end tell
end if
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment