Quantcast
Channel: Extensions - SketchUp Community
Viewing all articles
Browse latest Browse all 3616

Running a script on startup

$
0
0

I have a http call on my extension load it works fine and hits the server but the message box does not show. Here’s my sample code

my_extension.rb

module Woodlogic
  ex = SketchupExtension.new('Sample Fetch', 'sample_extension/fetch_server')
  Sketchup.register_extension(ex, true)
end

my_extension/my_own_extension.rb

class FetchServer
  request = Sketchup::Http::Request.new("http://localhost:3000", Sketchup::Http::POST)
  request.start do |request, response|
    if request.status == Sketchup::Http::STATUS_SUCCESS
      UI.messagebox 'Success', MB_OK
    else
      UI.messagebox 'Failed', MB_OK
    end
  end

But if I update the FetchServer and add a message box on the class it now shows the the status message box

class FetchServer
  request = Sketchup::Http::Request.new("http://localhost:3000", Sketchup::Http::POST)
  request.start do |request, response|
    if request.status == Sketchup::Http::STATUS_SUCCESS
      UI.messagebox 'Success', MB_OK
    else
      UI.messagebox 'Failed', MB_OK
    end
  end
  UI.messagebox 'Fetch called', MB_OK
end

Is there any work around so that I won’t need to call another message box?

1 post - 1 participant

Read full topic


Viewing all articles
Browse latest Browse all 3616


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>