Re: Simple AS question (BBEdit)
Re: Simple AS question (BBEdit)
- Subject: Re: Simple AS question (BBEdit)
- From: "Stockly, Ed" <email@hidden>
- Date: Thu, 05 Feb 2009 13:45:45 -0800
- Thread-topic: Simple AS question (BBEdit)
> That's what I'm worried about---that the document references are
> fragile. (At least that's how I interpret what I'm seeing.) Is there a
> way for me to get a non-fragile reference to each document that won't
> change as I open and close files?
What's happening is this command is returning a unique or stable document
reference:
set indexDoc to text document "textorders"
--> text document 1
The reference provided by this command is not unique to any document.
Anytime you apply indexDoc in your script it will refer to text document 1,
which is the front most text doc at the time the command is executed.
I'm not sure you need anything more than referring to the documents by name,
that reference works and you're using it in your script. But just in case...
tell application "BBEdit"
copy ID of document 1 to docId
tell (document 1 whose ID = docId)
text of window 1
end tell
end tell
--Applied to your script...
tell application "BBEdit"
set indexFile to thePath & "index.html"
open indexFile
set indexID to ID of text document "index.html"
set indexText1 to text of window 1 of (document 1 whose ID = indexID)
--set footerFile to thePath & "footer.shtml"
open footerFile
set footerId to ID of text document "footer.shtml"
set indexText2 to text of window 1 of (document 1 whose ID = indexID)
end tell
--FYI, I'm using an older version of BBEdit, but the script should work. You
may not need the window reference.
HTH,
ES
_______________________________________________
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