• 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
Scripting with two windows in BBEdit
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Scripting with two windows in BBEdit


  • Subject: Scripting with two windows in BBEdit
  • From: LuKreme <email@hidden>
  • Date: Sun, 18 Jul 2004 12:38:52 -0600

I have the following script snippage:

tell app "BBedit"
set TextWindow to make new text window with properties {name:"Results"}
set TempWindow to make new text window with properties {name:"Temp"}
set TextWinID to the ID of TextWindow
set TempWinID to the ID of TempWindow
end


tell application "BBEdit"
--temp window is empty at this point
set the selection of window id TempWinID to PageSource

--strip returns from PageSource to get all of the new page onto a single line

replace "\\r" using " " searching in text 1 of window id TempWinID options {search mode:grep, starting at top:true, wraparound:true, backwards:false, case sensitive:false, match words:false, extend selection:false}
-- Now, find the text we want and save it
find Text_Marker searching in text 1 of window id TempWinID options {search mode:grep, starting at top:true, wraparound:false, backwards:false, case sensitive:false, match words:false, extend selection:false} with selecting match
set Current_Text to (grep substitution of "\\1")
(*
Everything works exactly as I want up to this point and Current_Text contains the exact text I am looking for. However, the next two lines do not work. The second line is the one that generates the error ""BBEdit got an error: Can't set selection of window 20955241 to \"....the text I want\""
*)
select insertion point after the last line of text 1 of window id TextWinID
set the selection of window TextWinID to Current_Text

end tell

This second tell block is in a repeat loop. What I am trying to do is find the text i want in the temp window, copy it to the Results window, then reuse the temp window (after clearing it) for loading the next URL. but I can't seem to get BBEdit to switch to the "Results" window no matter what.


--
sometimes ascii is the best use of bandwidth... Tonya Engst
_______________________________________________
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.


  • Follow-Ups:
    • Re: Scripting with two windows in BBEdit
      • From: Malcolm Fitzgerald <email@hidden>
  • Prev by Date: scripting font change in TextEdit / NoteTaker, etc
  • Next by Date: Re: Long Filenames >31 error -37
  • Previous by thread: Re: scripting font change in TextEdit / NoteTaker, etc
  • Next by thread: Re: Scripting with two windows in BBEdit
  • Index(es):
    • Date
    • Thread