I use the following script to either create or update class properties.
When I run the script to add the properties, it works correctly and the properties are created
When I run the script again to update the properties, it works correctly and the properties are updated.
When I run the script once again to update the properties, it still works correctly and the properties are updated.
When I then close the project, and run the script again, the properties are not updated, but created again with the same name as the existing property.
When I then close the project again, and run the script once again, the properties are again not updated, but created once again with the same name as the existing property (we now have three properties with the same name in the same class.
For a video showing what happens idescriptingproblem video
I made a feedback ticket: <https://xojo.com/issue/51737>
Anyone know how to make sure the existing property is updated correctly? Is there a bug in my script, or if not, is there a workaround ?
Any ideas? @Greg O’Lone @Norman Palardy
OpenFile "/Users/dirkcleenwerck/Documents/scripttest/ScriptTest.xojo_binary_project"
Dim selected As Boolean = SelectProjectItem("APICallDocs")
If selected = False Then
Print "Something went wrong selecting APICallDocs"
Else
if location = "APICallDocs.v1_Contacts_GET" Then
Print "APICallDocs.v1_Contacts_GET Updated"
ChangeDeclaration("v1_Contacts_GET", "Updated", "String", 0, "")
Else
Print "APICallDocs.v1_Contacts_GET Created"
DoCommand("NewProperty")
ChangeDeclaration("v1_Contacts_GET", "Created", "String", 0, "")
End If
End If
selected = SelectProjectItem("APICalls")
If selected = False Then
Print "Something went wrong selecting APICalls"
Else
If location ="APICalls.v1_Contacts_GET" Then
Print "APICalls.v1_Contacts_GET Updated"
ChangeDeclaration("v1_Contacts_GET","Updated","String", 0,"")
Else
Print "APICalls.v1_Contacts_GET Created"
DoCommand("NewProperty")
ChangeDeclaration("v1_Contacts_GET","Created","String", 0,"")
End If
End if
DoCommand("SaveFile")
location = "APICallDocs.v1_Contacts_GET"
// Save active project
Print "Project Saved"