Note: this only works when loading the script action. Window > Scripting doesn't run the factory method for upindex variables