AppleScript support for tabs and windows

Is support for Bike tabs and windows via AppleScript incomplete at the moment? For example, I have one main Bike file (“overall.bike”) but have multiple tabs with different rows selected in each tab. However, when I run

on bike_windows()
    tell application "Bike"
        repeat with bikeWindow in windows
            set selectedText to selected text of document of bikeWindow
            log(selectedText)
        end repeat
    end tell
end bike_windows

I get only the selectedText of the tab in focus. Is this expected behavior?

Also I don’t see any mention of tabs in the Scripting dictionary for Bike. Tabs look like different windows as far as the AppleScript interface to Bike is concerned, from what I can see.

1 Like

Yes, or at least it’s not customized. Bike uses default Cocoa behavior for scripting windows. Mostly that behavior doesn’t have any special support for tabs, tabs are just exposed as normal windows.

It is. When you say:

selected text of document of bikeWindow

It’s really the document that you are asking for the selected text. And in that case I think it makes sense to always return the selected text of the frontmost window/view of that document. There are quite a few scriptable attributes of document that work this way. Focused row, hoisted row, etc.

I did it this way for simplicity, and also so I didn’t lock myself into a particular window representation. For example in some future I might put multiple outline views in a single window.

At the same time if this is really holding you back maybe I can re-evaluate. If that’s the case please let me know what you are trying to do.

2 Likes

Thanks for replying, Jesse. Your confirming that the behavior I see is what is expected is helpful to begin with. I am hoping ultimately to programmatically access what row I have selected (or focused) in any tab so that I can, for example, modify the right place in a given tab. But I can certainly work with the current behavior in Bike.

1 Like