• 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
Simple AS question (BBEdit)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Simple AS question (BBEdit)


  • Subject: Simple AS question (BBEdit)
  • From: Chris Goedde <email@hidden>
  • Date: Thu, 5 Feb 2009 12:00:08 -0600

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

  • Follow-Ups:
    • Re: Simple AS question (BBEdit)
      • From: "Mark J. Reed" <email@hidden>
  • Prev by Date: Re: Finding and shelling out to a sh script in the same directory as the AppleScript
  • Next by Date: Re: Simple AS question (BBEdit)
  • Previous by thread: Re: Finding and shelling out to a sh script in the same directory as the AppleScript
  • Next by thread: Re: Simple AS question (BBEdit)
  • Index(es):
    • Date
    • Thread