sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Web dialog on a Mac

    Scheduled Pinned Locked Moved Developers' Forum
    69 Posts 9 Posters 7.3k Views 9 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • A Offline
      adt2
      last edited by

      Garry - Where do I get the updated version? I can't find a download link...

      Andy

      1 Reply Last reply Reply Quote 0
      • G Offline
        Garry K
        last edited by

        It is on the stair maker thread

        http://sketchucation.com/forums/viewtopic.php?f=183%26amp;t=54157%26amp;p=510178#p510178

        1 Reply Last reply Reply Quote 0
        • G Offline
          Garry K
          last edited by

          Steve,

          In ruby the last statement in the callback is
          dialog.execute_script( script )

          In the web side there is a parsing routine plus the populate_drop_down function

          
          function from_ruby( data )
          {
          	var element;
          	var pair;
          	var pairs = data.split( '&' );
          	var count = pairs.length;
          
          	for ( var i = 0; i < count; i++ )
          	{
          		pair = pairs[i].split( '=' );
          
          		element = document.getElementById( pair[0] )
          
          		if ( element.type == "select-one" )
          		{
          			if ( pair[1].indexOf('|') == -1 )
          				element.selectedIndex = pair[1];
          			else
          				populate_drop_down( element, pair[1] );
          		}
          		else if ( element.type == "text" )
          			element.value = pair[1];
          		else if ( element.type == "checkbox" )
          			element.checked = pair[1] == '1';
          	}
          }
          
          

          It almost seems like the DOM isn't really ready to receive updates.

          1 Reply Last reply Reply Quote 0
          • D Offline
            driven
            last edited by

            <head>
            <script type="text/javascript">
            var xmlHttp = null;
            
            if ( document.addEventListener )
            	document.addEventListener( "DOMContentLoaded", ready, false );
            else if ( document.attachEvent )
            	document.attachEvent( "onreadystatechange", check_ready );
            
            function from_ruby( data )
            {
               xmlHttp = new XMLHttpRequest();
               xmlHttp.open( "POST", "http://cabmaker32.com//stairmaker_service.php", true );
               xmlHttp.onreadystatechange = handleRequestStateChange;
               xmlHttp.send( data );
            }
            function ruby_call( text )
            {
               window.location.href = 'skp;ruby_callback@' + text;
            }
            function handleRequestStateChange()
            {
            	if ( xmlHttp.readyState == 4 )
            	{
            		if ( xmlHttp.status == 200 )
            			ruby_call( xmlHttp.responseText );
            		else
            			ruby_call( 'error' );
            	}
            }
            function check_ready()
            {
            	if ( document.readyState === "complete" )
            		ready()
            }
            function ready()
            {
            	ruby_call( "loaded" );
            }
            </script>
            </head>
            

            this is all I can grab before I get the service denied message....

            learn from the mistakes of others, you may not live long enough to make them all yourself...

            1 Reply Last reply Reply Quote 0
            • S Offline
              slbaumgartner
              last edited by

              Screen Shot 2014-02-05 at 8.02.33 PM.png
              @garry k said:

              Steve,

              In ruby the last statement in the callback is
              dialog.execute_script( script )

              In the web side there is a parsing routine plus the populate_drop_down function

              
              > function from_ruby( data )
              > {
              > 	var element;
              > 	var pair;
              > 	var pairs = data.split( '&' );
              > 	var count = pairs.length;
              > 
              > 	for ( var i = 0; i < count; i++ )
              > 	{
              > 		pair = pairs[i].split( '=' );
              > 
              > 		element = document.getElementById( pair[0] )
              > 
              > 		if ( element.type == "select-one" )
              > 		{
              > 			if ( pair[1].indexOf('|') == -1 )
              > 				element.selectedIndex = pair[1];
              > 			else
              > 				populate_drop_down( element, pair[1] );
              > 		}
              > 		else if ( element.type == "text" )
              > 			element.value = pair[1];
              > 		else if ( element.type == "checkbox" )
              > 			element.checked = pair[1] == '1';
              > 	}
              > }
              > 
              

              It almost seems like the DOM isn't really ready to receive updates.

              I downloaded the rbz from the curved stairs topic hoping I could help, but all I get is this error dialog...

              1 Reply Last reply Reply Quote 0
              • D Offline
                driven
                last edited by

                it's Gary's birthday and 'her that needs to be obeyed' has curtailed his explorations....lol

                learn from the mistakes of others, you may not live long enough to make them all yourself...

                1 Reply Last reply Reply Quote 0
                • S Offline
                  slbaumgartner
                  last edited by

                  The first time I click "Stair Maker", a blank dialog window pops up at upper left and the Ruby Console displays:

                  show 1
                  loaded 1
                  cb1 complete

                  then after a moment that window disappears and the error message box appears. At that point the console adds:

                  closed 1

                  And I also notice that four new layers have been added to the model: Handrail, Risers, Stringers, Treads.

                  When I click ok on the error message box, the console adds:
                  loaded 2
                  cb2 complete

                  and this web dialog appears:

                  Screen Shot 2014-02-06 at 1.33.19 PM.png

                  If I click the Load button, any values I have typed into fields are reset and the console again adds:
                  loaded 2
                  cb2 complete

                  If I click the OK button, the web dialog closes and the console adds:
                  closed 2
                  cb2 complete

                  If I then select Stair Maker again, it immediately pops up the error message, without displaying the first three console messages about "1".

                  Since your Ruby is scrambled, I have no idea what is happening on that side, but does this behavior correspond to what you expect? If not, what exactly is the problem?

                  I noticed that your HTML has a bogus <body"> element. It appears that the WebDialog ignores it.

                  Steve

                  1 Reply Last reply Reply Quote 0
                  • G Offline
                    Garry K
                    last edited by

                    Steve,

                    Ok we are getting somewhere. Can you tell me if the input boxes and drop downs were populated before you clicked on the "Load" button.

                    "user not on file" at the top of the dialog is correct for an error code -21.
                    I believe that if you edit the defaults.txt file and stick in the user and password from registering with my web site that you would be able to create a circular stair.

                    I will temporarily make changes to the web service so that you don't have to edit the defaults.txt file. And I am going to rem out the extra messages and drop the load button.

                    1 Reply Last reply Reply Quote 0
                    • D Offline
                      driven
                      last edited by

                      garry

                      I'm not getting as far as steve...

                      from WebKit WebInspector inside SU...

                      [Error] SyntaxError; Expected token ')' (file;///, line 1)
                      > ready
                      < function ready() {
                      	ruby_call( "loaded" );
                      }
                      

                      learn from the mistakes of others, you may not live long enough to make them all yourself...

                      1 Reply Last reply Reply Quote 0
                      • G Offline
                        Garry K
                        last edited by

                        Did you update the defaults.txt file or leave it as 'user' and 'test'

                        1 Reply Last reply Reply Quote 0
                        • S Offline
                          slbaumgartner
                          last edited by

                          @garry k said:

                          Steve,

                          Ok we are getting somewhere. Can you tell me if the input boxes and drop downs were populated before you clicked on the "Load" button.

                          "user not on file" at the top of the dialog is correct for an error code -21.
                          I believe that if you edit the defaults.txt file and stick in the user and password from registering with my web site that you would be able to create a circular stair.

                          I will temporarily make changes to the web service so that you don't have to edit the defaults.txt file. And I am going to rem out the extra messages and drop the load button.

                          Yes, Garry, all the fields in the dialog were populated when it first appeared, including drop-down lists.

                          Steve

                          1 Reply Last reply Reply Quote 0
                          • S Offline
                            slbaumgartner
                            last edited by

                            @garry k said:

                            Steve,

                            Ok we are getting somewhere. Can you tell me if the input boxes and drop downs were populated before you clicked on the "Load" button.

                            "user not on file" at the top of the dialog is correct for an error code -21.
                            I believe that if you edit the defaults.txt file and stick in the user and password from registering with my web site that you would be able to create a circular stair.

                            I will temporarily make changes to the web service so that you don't have to edit the defaults.txt file. And I am going to rem out the extra messages and drop the load button.

                            I registered on your site, edited the info into the defaults.txt, and voila, got this:

                            Screen Shot 2014-02-06 at 9.42.19 PM.png

                            1 Reply Last reply Reply Quote 0
                            • jeff hammondJ Offline
                              jeff hammond
                              last edited by

                              @slbaumgartner said:

                              I registered on your site, edited the info into the defaults.txt, and voila, got this:

                              hmm.. strange.. a few of us are testing in the stairMaker thread and not getting that far.. we're using mavericks and 2013make or su8.. what OS / SU are you testing on?

                              [EDIT] just tried it on su8pro / mavericks and i'm still getting a window with all blank fields/menus.. i'll try it on my other computer running lion in an hour or so.

                              dotdotdot

                              1 Reply Last reply Reply Quote 0
                              • jeff hammondJ Offline
                                jeff hammond
                                last edited by

                                just tried it on Lion (os x 10.7.5) with su2013 and su8.. i'm getting the http error & cannot reach web service error..

                                i'm on the same wifi network as my mavericks laptop using the same 1.0.6 rbz.. i checked and double checked my username & pword were edited properly in the txt file..

                                the mavericks computer connects and the lion macpro doesn't.

                                [just in case, i had some OS updates which needed install on lion.. a security update and a java update.. installed those, repaired permissions, rebooted... same problem.. but at least i got that computer up to date 😉 ..or as up to date as 1,1 macpro can be without hacking it ]

                                dotdotdot

                                1 Reply Last reply Reply Quote 0
                                • S Offline
                                  slbaumgartner
                                  last edited by

                                  @jeff hammond said:

                                  @slbaumgartner said:

                                  I registered on your site, edited the info into the defaults.txt, and voila, got this:

                                  hmm.. strange.. a few of us are testing in the stairMaker thread and not getting that far.. we're using mavericks and 2013make or su8.. what OS / SU are you testing on?

                                  [EDIT] just tried it on su8pro / mavericks and i'm still getting a window with all blank fields/menus.. i'll try it on my other computer running lion in an hour or so.

                                  That was on SU 8 Free, MBPr, Mavericks.
                                  Steve

                                  1 Reply Last reply Reply Quote 0
                                  • S Offline
                                    slbaumgartner
                                    last edited by

                                    @jeff hammond said:

                                    @slbaumgartner said:

                                    I registered on your site, edited the info into the defaults.txt, and voila, got this:

                                    hmm.. strange.. a few of us are testing in the stairMaker thread and not getting that far.. we're using mavericks and 2013make or su8.. what OS / SU are you testing on?

                                    [EDIT] just tried it on su8pro / mavericks and i'm still getting a window with all blank fields/menus.. i'll try it on my other computer running lion in an hour or so.

                                    I just tried using SU 2013 Make (still on Pro trial period) on MBPr, Mavericks, and that worked too. This was a clean (no other plugins) install of 2013 Make, but for my previous test on SU8 Free I hadn't disabled anything.

                                    For me, 1.0.6 was the first installation of the stair maker. Any chance previous installs left something behind that is interfering on your computer?

                                    Another thought - could this be a race condition? My MBPr is relatively fast, and once before driven and I got different results on another script evidently because his machine was slower than mine...

                                    1 Reply Last reply Reply Quote 0
                                    • D Offline
                                      driven
                                      last edited by

                                      'that' error with updated txt file
                                      then
                                      deleted all and reinstall...

                                      show 1
                                      loaded 1
                                      cb1 complete
                                      closed 1
                                      Error; #<NoMethodError; undefined method `join' for #<Enumerator; ["Housed", "Sawtooth", "None"];collect>>
                                      /users/johns_imac/library/application support/sketchup 
                                      

                                      learn from the mistakes of others, you may not live long enough to make them all yourself...

                                      1 Reply Last reply Reply Quote 0
                                      • D Offline
                                        driven
                                        last edited by

                                        @slbaumgartner said:

                                        Another thought - could this be a race condition? My MBPr is relatively fast, and once before driven and I got different results on another script evidently because his machine was slower than mine...

                                        and, another...

                                        could the server being a lot further away from London UK have an effect?...

                                        or are we all on the same WebKit version?

                                        navigator.userAgent
                                        

                                        < "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.73.11 (KHTML, like Gecko) SketchUp/13.0 (Mac; Safari)"

                                        john

                                        learn from the mistakes of others, you may not live long enough to make them all yourself...

                                        1 Reply Last reply Reply Quote 0
                                        • jeff hammondJ Offline
                                          jeff hammond
                                          last edited by

                                          @slbaumgartner said:

                                          I just tried using SU 2013 Make (still on Pro trial period) on MBPr, Mavericks, and that worked too. This was a clean (no other plugins) install of 2013 Make, but for my previous test on SU8 Free I hadn't disabled anything.

                                          For me, 1.0.6 was the first installation of the stair maker. Any chance previous installs left something behind that is interfering on your computer?

                                          Another thought - could this be a race condition? My MBPr is relatively fast, and once before driven and I got different results on another script evidently because his machine was slower than mine...

                                          probably not a race.. i've mostly been trying it on my mbp.. 2.66GHz i7.. i don't think apple makes a faster one.
                                          (albeit mine is arrandale and i guess i can't straight compare clock speed to ,say, 2.6 haswell but still...)

                                          also, when i tried 1.0.6 on lion last night, it was the first time i put stairmaker on that computer.

                                          dotdotdot

                                          1 Reply Last reply Reply Quote 0
                                          • D Offline
                                            driven
                                            last edited by

                                            @Jeff,

                                            It's making the spiral here, after I manually deleted [ file and folder ] and then re-installed [ .rbz ] into v2013 and re-edited the text file...

                                            john

                                            learn from the mistakes of others, you may not live long enough to make them all yourself...

                                            1 Reply Last reply Reply Quote 0
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 2 / 4
                                            • First post
                                              Last post
                                            Buy SketchPlus
                                            Buy SUbD
                                            Buy WrapR
                                            Buy eBook
                                            Buy Modelur
                                            Buy Vertex Tools
                                            Buy SketchCuisine
                                            Buy FormFonts

                                            Advertisement