BBEdit 14.1.2, Mac OS Monterey 12.4
Using AppleScript, I want to navigate into a folder in a collection in a project window. I have the following script:
tell application "BBEdit"
try
set project to project document "ZBA.bbprojectd"
on error
display alert ¬
"The ZBA project is not open in BBEdit" as warning message ¬
"Open the ZBA project and try again" buttons "OK" default button "OK"
return
end try
set site to project's project collection "Site"
set cases to site's first project item whose name is "cases"
end tell
Debugging it in ScriptDebugger, the "
set project” command successfully accesses the project, and sets
project to a BBEdit
project document object. When I examine it in the debugger, it contains a dozen
project collection elements.
project collection 10 is named “Site” and represents a folder on disk. However, after executing the “
set site” command,
site is
not a BBEdit
project collection object — it is a file reference to the folder represented by the collection ( «class file» "Macintosh HD:Users:neil:Library:Mobile Documents:com~apple~CloudDocs:zba:Web Site:
wiltonzba.org:" ).
Can anyone explain this behavior, or, even better, how to get at the project collection (and its contents0 as I intended?
Thanks,
Neil Faiman