Q:

Why am I getting an error using replace in AppleScript for BBEdit?

I'm trying to make an AppleScript for BBEdit to move everything up one hour on a schedule by replacing each hour with the next hour. I've used AppleScript and BBEdit quite a bit before, but this is my first time using them together and I don't know what's going wrong. Here's the first two lines of my script.
tell application "BBEdit"
replace text "12:" using text "{#pl}:"
"{#pl}:" is a placeholder. I've tried this first without the "text" keywords and got the same error. Whenever I run this I get an error message saying "BBEdit got an error: text "12:" doesn’t understand the “replace” message." What's the problem and how do I make this do what I want? Thanks.

A:

You need a target for the replace command, either through another tell statement or the searching in parameter.  It would probably help to also include where to start, for example:
tell application "BBEdit"
   tell front document
      replace "12:" using "{#pl}:" options {starting at top:true}
   end tell
end tell

-- or --

tell application "BBEdit" to replace "12:" using "{#pl}:" searching in front document options {starting at top:true}

