scripting / drummerRFC

A place to post RFCs for people who use and develop in Drummer.
MIT License
11 stars 0 forks source link

Verb idea: tab.getFilePath #16

Closed PostMonsterG closed 2 years ago

PostMonsterG commented 2 years ago

I would find this very useful.

I thought about something like tab.getFileInfo, which would return the same type of structure as file.getFileInfo. However, I think that might be confusing. And, once you have the path from the tab, you can get the other info with the verb that's already there.

I also considered a couple other options like tab.getOutlineUrl (returns the URL of the open tab, if it's not a Drummer file), and tab.getInfo (returns some structure that combines both getFileInfo and URL-type stuff). I don't have a use right now for the first, and the second is basically a whole new API, so I discarded those as well.

tab.getFilePath

Syntax

tab.getFilePath()

Params

None

What it does

If the outline in the current tab in the outliner is a Drummer file, returns the path to the file

Returns

The path to the file, or null if the outline in the current tab is not a Drummer file

Examples

tab.getFilePath ()

Notes

This verb returns null if the tab is not a Drummer file rather than undefined because the value is known to be null

PostMonsterG commented 2 years ago

I think returning undefined is probably better than null, so please disregard that part of the idea.

scripting commented 2 years ago

This is a good idea. For some reason I thought we already had this functionality but I just scanned the list of verbs and couldn't find it. Obviously a verb that gets you info about the current file would be a good thing to have.

Also, I like the way you did the DocServer page for it as a way of specifying it. ;-)

scripting commented 2 years ago

Here you go --

http://docserver.scripting.com/?verb=tab.getActiveTabStatus

Dave

PostMonsterG commented 2 years ago

Hot dog, that is perfect for my needs. Works great. Thank you!