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

    Win 7 to Win 8 => no system() anymore...

    Scheduled Pinned Locked Moved Developers' Forum
    10 Posts 6 Posters 187 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.
    • N Offline
      niccah
      last edited by

      Hey!

      I have a strange problem again...

      I switched from Windows 7 to Windows 8. Now, I would like to start my external Java application, but without success!

      UI.messagebox "a" output = system("java -jar Model2GCode.jar") UI.messagebox "b"

      "a" and "b" is shown normally in the UI.messagebox. But no command line!

      When I started the jar-file manually in the command line, it works...

      Do you have an idea, what's different in Windows 8?

      I thank you very much for your help!

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

        I have a Win8 machine at home. Do you have a complete example to test that works under Win7 but not Win8?

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

        1 Reply Last reply Reply Quote 0
        • A Offline
          Aerilius
          last edited by

          That is good to know (there is not yet official Win8 support, but this needs to be tested and considered). I'm curious to know whether this happens to other users who have Windows 8?

          I've experienced under different circumstances that the system() command didn't work (maybe it is more likely to break). (although it should work 99+%)
          A reliable method is also to write the command to a batch file and launch the batch file with UI.openURL("/path/to/file.bat")
          UI.openURL doesn't support arguments. So the arguments go into the batch file which Windows recognizes as executable because of its file extension.

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

            Have you tried
            system(java -jar Model2GCode.jar)
            Have you also tried this
            pwd=Dir.pwd Dir.chdir(Model2GCodeJarsFolder) system(java -jar Model2GCode.jar) Dir.chdir(pwd)
            to ensure it finds the .jar file ?

            TIG

            1 Reply Last reply Reply Quote 0
            • N Offline
              niccah
              last edited by

              @tig said:

              Have you tried
              system(java -jar Model2GCode.jar)
              Have you also tried this
              pwd=Dir.pwd Dir.chdir(Model2GCodeJarsFolder) system(java -jar Model2GCode.jar) Dir.chdir(pwd)
              to ensure it finds the .jar file ?

              So, at first: thank you very much for your help!

              I tried follow things:

              odir=Dir.pwd Dir.chdir(File.dirname(__FILE__)) output = system("java -jar Model2GCode.jar")) Dir.chdir(odir)

              odir=Dir.pwd Dir.chdir(File.dirname(__FILE__)) output = system('java -jar Model2GCode.jar')) Dir.chdir(odir)

              odir=Dir.pwd Dir.chdir(File.dirname(__FILE__)) output = system('java -jar ' + File.join(File.dirname(__FILE__), 'Model2GCode.jar')) Dir.chdir(odir)

              @Thom: Should I send you this jar-File? It would be great, if you can test it on your machine!

              One other idea:

              • since Win 8, I'm not able to edit the plugin files with my editor, just in admin mode (arg)
              • so I think, Win 8 increased the "security levels" => could it be: for the ruby application it is not allowed anymore to start the command line?

              Thanks a lot!

              1 Reply Last reply Reply Quote 0
              • N Offline
                niccah
                last edited by

                @aerilius said:

                UI.openURL("/path/to/file.bat")

                Ahh, I remember - you told me this method some month ago! Thanks for this hint! I will try it at home...

                And in the bat file I will write just: java -jar Model2GCode.jar ?

                So, if I can write the bat file with ruby, then I can insert very easily the arguments into it...

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

                  @niccah said:

                  • since Win 8, I'm not able to edit the plugin files with my editor, just in admin mode (arg)
                  • so I think, Win 8 increased the "security levels" => could it be: for the ruby application it is not allowed anymore to start the command line?

                  You're editing your plugins directly from the Plugins folder?

                  The thing is, Windows doesn't want the user to modify anything with the Program Files folders. It's reserved for application installers only.

                  I keep my plugins in a Dropbox folder, so they keep in sync between computers. I then add a .rb file in the Plugins folder that adds that folder to the $LOAD_PATH array and then loops over all the rb and rbs files to load them. That way I'm working on my plugins in a location where I have full permissions.

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

                  1 Reply Last reply Reply Quote 0
                  • N Offline
                    niccah
                    last edited by

                    @thomthom said:

                    that adds that folder to the $LOAD_PATH array

                    I never stop learning! πŸ˜„ Thanks, I will try it...

                    Using Win 7, editing the files wasn't a big problem...

                    1 Reply Last reply Reply Quote 0
                    • PixeroP Offline
                      Pixero
                      last edited by

                      @thomthom said:

                      I keep my plugins in a Dropbox folder, so they keep in sync between computers. I then add a .rb file in the Plugins folder that adds that folder to the $LOAD_PATH array and then loops over all the rb and rbs files to load them. That way I'm working on my plugins in a location where I have full permissions.

                      Could you please post how that file looks in its entirety? I would like to get that to work for me as well.

                      1 Reply Last reply Reply Quote 0
                      • Dan RathbunD Offline
                        Dan Rathbun
                        last edited by

                        @pixero said:

                        @thomthom said:

                        ... I then add a .rb file in the Plugins folder that adds that folder to the $LOAD_PATH array and then loops over all the rb and rbs files to load them. That way I'm working on my plugins in a location where I have full permissions.

                        Could you please post how that file looks in its entirety? I would like to get that to work for me as well.

                        @Pixero, and anyone else.. I have already posted such a script, ready-made for you to modify with your custom paths, be it a dropbox or just folders in your "user/documents" path (which you will always have full permissions to.)

                        In addition, it adds an autoload feature that looks for sub-directories named " %(#408000)[!_autoload]", in ALL of the $LOAD_PATH directories, and if found, will call require on any loadable files it finds.

                        I do this because this way you KNOW what files (in those custom paths,) will be automatically loading.

                        Here's the link: [Code] !autoload.rb loads "!_autoload" folders

                        πŸ’­

                        I'm not here much anymore.

                        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