Using Script Debugger's Dictionary Explorer tab, I see this:
So given that, this works:
tell application "Xcode"
tell text document "TestTarget.swift"
get contents as text
end tell
end tell
It may only work for separate windows. That's what I have right now.
@peternlewis As youâve probably already discovered, my above post doesnât solve the issue.
If you only have the document opened in one window, you can get to it by getting the front window (which I think is always index 0), using that windowâs name and find the textDocument for the file with that name. This is all theory, but it should work.
But if you have it opened in more than one window, or if you have multiple tabs open, or if youâve split the window⌠donât know yet.
If you figure it out, please let me know. I had thought for sure that in AS âfront text documentâ worked, but I was wrong.