I want to run a script after su has been started from double clicking an skp

Hello,

I run a license validation check for our extension when sketchup starts, which works great, except when someone opens sketchup by double clicking an skp in explorer and the skp is very large and kind of hangs up sketchup anyway. My validation request to the license server times out and the ruby console pops up and displays an error. I don’t want that to happen to users. I am trying to find a way to know that sketchup has completely started and is ready to go before I run my validation check. Does anyone know if there is a consistent reliable way to do that?

Thank You,

Anton

Perhaps using an App Observer that your script adds before doing the check ?
http://ruby.sketchup.com/Sketchup/AppObserver.html#onOpenModel-instance_method
or
http://ruby.sketchup.com/Sketchup/AppObserver.html#expectsStartupModelNotifications-instance_method
??
Perhaps with a UI.start_timer... checker to wait a few seconds before checking the license ?

1 Like

you should move your validation to ‘lazy load’ only if the User actually wants to run your extension in that session…

polluting startup with validations and observers just slows things down and makes SU look bad…

you can still setup menus and toolbars, but they should only load logic and check validation when called…

john

4 Likes

I agree fully with John. I’m too lazy to implement lazy loading general, but license checks that go over the internet can wait until the user actually interacts with the extension.

1 Like

Tldr: use Sketchup:Http (https://ruby.sketchup.com/Sketchup/Http.html)
There is a bug on windows with standard ruby and http requests.

Solved in sketchup 2019 dough.

Thus: lazy loading won’t help you since the first interaction with your app will still take x seconds, or even minutes. See: https://stackoverflow.com/questions/29984838/openssl-causing-very-slow-rails-boot-time-on-windows

And this: https://wiki.openssl.org/index.php/Random_Numbers#Windows_Issues

indows Issues[edit]

Windows platforms offer two potential problems to OpenSSL’s RAND_poll. First is a hang due to the heap walk, and second is Application Verifier failures due to use of Windows’ API call netstatget.

See Bug 2100 for details on the heap walk issue. See UAC related errors on windows 7 64-bit with Application Verifierfor details and a workaround for the Application Verifier issue.

1 Like

And… out of curiously, which extension?

Thanks for the information!

Thanks for the replies, everyone! I really appreciate it!