I want to update an extension of mine, and in order for users to use a certain feature in the extension, they will have to update to the newest version of it. Currently I have it set so that if they try to use the feature it will run a quick check to see if they have the most current version and if they don’t, a message-box will pop up asking them to update their extension and the Extension Manager page will load up on their screen with UI.show_extension_manager.
I was hoping that I could take it one step further and once the Extension Manager loads, the tab would change to the “Manage” tab so that they would automatically be brought to the page were they would update the extension. Is there any code that would allow me to change the tab in the Extension Manager after it pops up?
I’ll readily yield to someone who knows otherwise, but I am not aware of any such feature in the Ruby API and seriously doubt there is a way to do this short of some sort of external keypress simulator.
I’m quite confused about how this semi-implemented feature works. How are you going to update the extension to make it tell people to update it when they try to use a certain feature? Why not implement the feature at the same time you implement a way to invoke it?
As for switching tab in the Extension Manager there is no API for that, and who knows, in a few years the Extension Manager perhaps doesn’t have tabs but have the update functionality available in the default view. The less an extension (or other software for that matter) can be integrated to other systems or make assumptions about its surroundings, the simpler and more stable that software will be.
Basically, we have a program that we created internally at my company and one of the exports available is a ruby script file that can be opened in my SketchUp Extension. I have a statement in the exported ruby script that checks a version-number-variable in the extension’s ruby script when they use that specific feature and if they do not match, it will prompt the user to update their extension.
Where our company’s program automatically updates to the newest version when it is opened, SketchUp extensions do not automatically update so I can’t assume that the users are using the newest version of both the extension and our program.
Your point about not relying on how the extension manager is set up makes a lot of sense though. In the future if the Extension Manager were to change it could possibly break my extension which would not be ideal.
I think that a lot of my extension’s users are not familiar with how updating extensions in SketchUp works so I wanted to make it as convenient as possible for them to get to the “Manage” tab, but after the point you brought up I think I’ll just add a little more guidance on how to update the extension in my messagebox that pops up.
That makes sense. It’s basically this functionality of SketchUp you want to implement in the extension if I understand it correctly, but assisting in updating.
Ideally the user should be given Yes/No question if they want to update right away, and don’t have to carry out any instructions themselves. You can look into Sketchup.install_from_archive to see if this can be done.
Btw, I would strongly recommend to export serialized data and import it to SketchUp in another way than as a Ruby file that executes when loaded. This could be used for injecting malicious code. Code with the system access a SketchUp plugin has should only run if the user has given consent to run it, which you do by installing a software, not by merely opening a file.