IDE Script to traverse project?

I see that SubLocations doesn’t return sub items (Events, Methods etc.) of things like Windows, is there another way to traverse everything in a project or is SubLocation bugged?

Try the following IDE Script on a new project with an open event on Window1 and it’s not shown, any idea how to find it?

Thanks in advance.

[code]Dim s As String = “”

Sub Traverse(path As String)
s = s + “” + path + EndOfLine

Dim itemList As String
itemList = Sublocations(path)

Dim items() As String
items = itemList.Split(ChrB(9))

Dim name As String
For Each name In items
If path <> “” Then name = path + “.” + name
End Sub



@JulianS — You should be able to access windows using WindowCount, WindowTitle, SelectWindow…

Unfortunately those are the open IDE windows, not the content of the project, events, methods etc. :frowning:

@JulianS — Actually it seems to work fine for me (Xojo 2019r1 - macOS 10.14.4)

print(sublocations( "" ))

From a new project, I get everything including Window1

Just how do you get the Methods, Events, ?

I’ve once tried to apply StandardizeFormat to a whole project (not just the selected code). <>

That would require to “loop” through all “code content” in a project (including Methods, Events, )
@NormanPalardy mentioned several times I could use an IDE Script for that - but I still don’t know how :slight_smile:
That’s as far as I could get: IDE Script: Loop through Project Items
I still would like to know how to get even further down…

Aye Jurg, I noted Norman talking about it which got me thinking about it in the first place. I asked Norman off forum after I posted this and he confirmed it’s not possible with the current ide script features so he might have been mistaken at the time.

From what I can gather, ide script was implemented to bridge a few build automation requirements and anything else was just a fortunate byproduct. I don’t think they had/have the resources to pile into an all singing all dancing ide scripting system what you could run the entire ide from code. There are a few feedback requests in the system for such but they’ve been there for a looong time and considering reformatting took 8 years <> I can’t see it happening any time soon.

In terms of mass reformatting, I guess it’ll have to be brought outside the ide. Using the new reformat code system would have been a nice solution if we could just traverse the project, I did have something else in mind for using the traversal, but that was shot down before I started :frowning: