Re: Simple AS question (BBEdit)
Re: Simple AS question (BBEdit)
- Subject: Re: Simple AS question (BBEdit)
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 5 Feb 2009 13:08:50 -0500
I'm no BBEdit expert, but it looks like you're essentially getting
back a reference to "whatever document is open in window 1".
That would imply that of you want to open multiple documents, you need
to either open them in different windows, or do everything you intend
to do with a document while it's open, before opening a different
one. e.g. do "set indexText to (get text of indexDoc)" *before*
opening the footer.
On Thu, Feb 5, 2009 at 1:00 PM, Chris Goedde <email@hidden> wrote:
> I think I'm not very good at reading/understanding dictionaries, or
> maybe I just don't understand Applescript, but the following is the
> sort of thing that always gets me. I have the following script:
>
> set thePath to (path to desktop as string)
> set theOffset to offset of "Desktop" in thePath
> set thePath to (text 1 through (theOffset - 1) of thePath)
> set thePath to thePath & "Documents:Work:Professional:STEP:Web
> Site:Development:"
>
> tell application "BBEdit"
>
> set indexFile to thePath & "index.html"
> open indexFile
> set indexDoc to text document "index.html" of window 1
>
> set footerFile to thePath & "footer.shtml"
> open footerFile
> set footerDoc to text document "footer.shtml" of window 1
>
> set indexText to text of indexDoc
> set footerText to text of footerDoc
>
> end tell
>
> The intent of this script is to open up two files in BBEdit (9.1) and
> grab their text. Here's the thing: when I run it, both indexText and
> footerText end up containing the text of footer.shtml, and indexDoc
> and footerDoc are the same document (viewing them in Script
> Debugger). I've been playing around and (re)reading parts of Matt's
> book, and I think I sort of, kind of have an idea of what's happening,
> but I could really use a explanation from an expert. Help, please!
>
> As a more general question, what's the best way to get a bunch of
> documents in BBEdit so that I can later manipulate them, get their
> text, add text to them, save them, etc?
>
> Thanks.
>
> Chris Goedde
> _______________________________________________
> Do not post admin requests to the list. They will be ignored.
> AppleScript-Users mailing list (email@hidden)
> Help/Unsubscribe/Update your Subscription:
> Archives: http://lists.apple.com/archives/applescript-users
>
> This email sent to email@hidden
>
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden