I found some old documentation, so I worked it out.
This is the revised code:
Dim importingClass as String = ProjectItem
// get the properties and methods and loop through them
// convert name and type to Xojo
if SelectProjectItem(importingClass) then
DoCommand "NewProperty"
ChangeDeclaration(name, "", type, 0, "")
end if
The updated script looks good, especially using SelectProjectItem() to pick the right item. For anyone new, checking the DoCommand docs like Emile said can help a lot. It’s a nice way to learn more about automation in Xojo.