How can you get the BBEdit active document in AppleScript?
To get the active document in AppleScript you would target the application:
applescripttell application "BBEdit"end tell
After indicating what application we are using we must ensure it is active:
applescripttell application "BBEdit"activateend tell
Since we have activated the app we can target the project's active document with:
applescripttell application "BBEdit"activateset workingFile to (name of active document of project window 1)end tell
if you'd like to get a display of the name you can:
applescripttell application "BBEdit"activateset workingFile to (name of active document of project window 1)display dialog workingFile as textend tell
if you do not want the display but do want to see the result, you can enable the log in Script Editor then change the script to:
applescripttell application "BBEdit"activateset workingFile to (name of active document of project window 1)return workingFileend tell