sketchucation logo sketchucation
    • Login
    🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    My plugin work on Windows not on Mac

    Scheduled Pinned Locked Moved Developers' Forum
    18 Posts 6 Posters 214 Views 6 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.
    • X Offline
      xfifi
      last edited by

      Hi,

      I started to develop a plugin for drawing rectangular aquariums. It works well on Windows. A Mac user tells me it does not work on his Mac (webdialog window empty).
      What could be the problem? I Have scrambled the main file, it may be that?

      Thank you.

      Philippe


      AquaDesigner 0.7preview

      1 Reply Last reply Reply Quote 0
      • Chris FullmerC Offline
        Chris Fullmer
        last edited by

        It could be a lot of things. I think you won't get much help here without providing an unscrambled version? I'm sure people can present possible ideas, but it might just be easiest to see the actual script.

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • X Offline
          xfifi
          last edited by

          Ok, I put an unscrambled version in file attachment. Sorry for the UI that is in French.

          Thank you.


          Unscrambled version AquaDesignerv0.7prw

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            Empty WebDialog window might be that you're using WebDialog.set_html (Are you? I have not looked at your source yet.)

            If you're new to SketchUp plugin development, I got some links that might help you:
            WebDialogs: http://sketchucation.com/forums/viewtopic.php?f=180&t=23445

            General on developing plugins: http://www.thomthom.net/thoughts/2012/01/golden-rules-of-sketchup-plugin-development/

            There's more articles on more specific topics on my blog there - including my et peeve, #typename http://www.thomthom.net/thoughts/2011/12/never-ever-use-typename/

            Thomas Thomassen — SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • X Offline
              xfifi
              last edited by

              Yes, i'm a beginner with ruby and Sketchup plugin development.
              My plugin work very well on my PC but it is very weird on Mac.

              I use Weddialog.set_file however.

              Thank you for all these links.

              1 Reply Last reply Reply Quote 0
              • TIGT Offline
                TIG Moderator
                last edited by

                The API's weddialog.set_file() is known to fail...
                Put simply set_html() fails under OSX because of a ill contrived Safari update.
                Whereas using set_url() should work on all Platforms.

                TIG

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  @tig said:

                  The API's weddialog.set_file() is known to fail...

                  ?

                  Never had any issues with it - on any platform. Example?

                  Thomas Thomassen — SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • TIGT Offline
                    TIG Moderator
                    last edited by

                    Typo - I meant set_html() 😒
                    Doh!
                    Hence my reference to it in my next sentence 😕
                    😕
                    Still confused about how that happened... too much Rioja with my Sunday dinner 😮

                    TIG

                    1 Reply Last reply Reply Quote 0
                    • Mike LuceyM Offline
                      Mike Lucey
                      last edited by

                      Ahhhh ..... I know only too well that one Tinto can lead to many 😄

                      http://upload.wikimedia.org/wikipedia/commons/thumb/8/82/Rioja_wine_crop_of_ImagePinchos_aperitivo.JPG/220px-Rioja_wine_crop_of_ImagePinchos_aperitivo.JPG

                      Support us so we can support you! Upgrade to Premium Membership!

                      1 Reply Last reply Reply Quote 0
                      • X Offline
                        xfifi
                        last edited by

                        Hi,

                        I replaced set_file by set_url and i have the same issue (on Mac "empty white" content in webdialog).

                        1 Reply Last reply Reply Quote 0
                        • TIGT Offline
                          TIG Moderator
                          last edited by

                          Revert to as it was - didn't you read the posts about my typo?
                          Without seeing exactly how you rb interacts with the html/js etc we are stuck... 😕

                          TIG

                          1 Reply Last reply Reply Quote 0
                          • X Offline
                            xfifi
                            last edited by

                            Ok I put it back like it was before.

                            I put the full archive of my plugin a few posts above.

                            1 Reply Last reply Reply Quote 0
                            • TIGT Offline
                              TIG Moderator
                              last edited by

                              OK. 😄
                              You are typically using:
                              @wnd_params.execute_script("$('#longueur').val('#{s_longueur}')")
                              to set the 'value' of id=longueur to be s_longueur
                              Try constructing it a different way: perhaps the MAC doesn't like it: perhaps something more like:
                              @wnd_params.execute_script("document.getElementById('longueur').setAttribute('value','#{s_longueur}');")
                              ??? 😕
                              If it's not a 'value' then try something like 'innerHTML' OR 'innerTEXT': e.g.:
                              @wnd_params.execute_script("document.getElementById('longueur').innerHTML='#{s_longueur}');")
                              etc...
                              ❓

                              TIG

                              1 Reply Last reply Reply Quote 0
                              • thomthomT Offline
                                thomthom
                                last edited by

                                Not near a Mac to test at the moment. But have you tried with adding ; at the end of each command you execute?

                                (Sidenote, if you use that script in a model with untis settings set to display feet you'll get ' characters that will break your javascript because you're no escaping your string.)

                                (Sitenote 2: 120.cm.to_l the .to_l is redundant as .cm will return a Length object.)

                                Thomas Thomassen — SketchUp Monkey & Coding addict
                                List of my plugins and link to the CookieWare fund

                                1 Reply Last reply Reply Quote 0
                                • TIGT Offline
                                  TIG Moderator
                                  last edited by

                                  TT, well spotted that he has missed a ' **;**' terminating his script string - I missed that - however, it doesn't why it's PC friendly / MAC unfriendly - I recall something about MAC's changing the way 'innerHTML' / 'innerTEXT' worked a few Safari updates ago - perhaps that's the rub? 😕

                                  TIG

                                  1 Reply Last reply Reply Quote 0
                                  • thomthomT Offline
                                    thomthom
                                    last edited by

                                    Nah - he's using jQuery. It takes care of all compatibility issues like that. I've used jQuery for several years now and none of them has broken. Certainly not the ones he's using there.

                                    Thomas Thomassen — SketchUp Monkey & Coding addict
                                    List of my plugins and link to the CookieWare fund

                                    1 Reply Last reply Reply Quote 0
                                    • X Offline
                                      xfifi
                                      last edited by

                                      First, thank you both try to help me on these issues.
                                      Well done for small errors in my code.
                                      I added the ";" at the end of javascript strings and i changed the code as :
                                      @wnd_params.execute_script("$('#longueur').val(#{s_longueur.inspect});") to escape ' and " characters

                                      I don't have a Mac at hand either. I have to wait for a Mac user have the time to try my corrections and then give me the result.

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

                                        if I change the rubies encoding to uft8 and I zapp the gremlins I get this which shows the css for font size is not good. use ems
                                        2012-11-30 08.31.12 pm.png

                                        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 / 1
                                        • First post
                                          Last post
                                        Buy SketchPlus
                                        Buy SUbD
                                        Buy WrapR
                                        Buy eBook
                                        Buy Modelur
                                        Buy Vertex Tools
                                        Buy SketchCuisine
                                        Buy FormFonts

                                        Advertisement