Goes through all opened document tab names (including floated document windows (which can potentially have multiple tabs too)) looking for a tab with a name that contains the string from my desired_tab_name variable. If it exists, switch to it, if it doesnt exist, open a file on disk at a filepath from my desired_doc_filepath.
Pseudo code:
Code: Select all
desired_tab_name = "tabname" // look for this in opened tabs and floated document window names
desired_doc_filepath = "filepath" // this filepath gets opened if the desired tabname wasnt found
found_tab_id = -1
loop ( all opened document tab names (including floated document windows) )
(
if (looped tab name contains $desired_tab_name)
(
found_tab_id = ?api? // get the tab's index or whatever ps uses to then switch to the tab
end loop
)
)
if ( found_tab_id != -1 ) // something was found and overwrote the default value
( switch to the tab's id )
else
( open file at $desired_doc_filepath )
big thanks if anyone helps, i cannot possibly imagine messing with yet another language and api manual right now