sketchucation logo sketchucation
    • Login
    ๐Ÿ›ฃ๏ธ Road Profile Builder | Generate roads, curbs and pavements easily Download

    UI.openURL(executable + params)

    Scheduled Pinned Locked Moved Developers' Forum
    17 Posts 6 Posters 3.8k 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.
    • Didier BurD Offline
      Didier Bur
      last edited by

      I don't agree with Rick, openurl is not restricted to internet links.
      One can write: UI.openURL("file://" + the_file_to_open)
      The system then uses the registry to launch the correct app.
      You can also write UI.openURL("c:\test.exe"), this will launch the programm "test"
      I guess you could do it also on Mac, but there are no registry and extensions on it...
      I don't know if you can add parameters to the command ๐Ÿ˜ณ
      Regards,

      DB

      1 Reply Last reply Reply Quote 0
      • T Offline
        tomasz
        last edited by

        Thanks Lads,

        Azuby has killed me, I hope I will recover soon ๐Ÿ˜„.
        I need to run Kerkythea.exe (on Mac kerkythea) with single parameter (KT script file name).
        On PC I create separate start.bat file containing :
        kerkyhea.exe start.kst

        Then I run this batch using UI.openURL(C:\start.bat) which opens command line window, starts batch file and finally opens KT. 'Dos' window is visible in the background so it is not clean solution.

        Azuby - how it will look using your backtick? ๐Ÿ˜†

        Tomasz

        Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

        1 Reply Last reply Reply Quote 0
        • R Offline
          RickW
          last edited by

          @didier bur said:

          I don't agree with Rick, openurl is not restricted to internet links.
          One can write: UI.openURL("file://" + the_file_to_open)
          The system then uses the registry to launch the correct app.
          You can also write UI.openURL("c:\test.exe"), this will launch the programm "test"
          I guess you could do it also on Mac, but there are no registry and extensions on it...
          I don't know if you can add parameters to the command ๐Ÿ˜ณ
          Regards,

          I didn't say you couldn't open an app, I said you couldn't use parameters. ๐Ÿ˜„
          Just because something can be done doesn't mean it was intended. So, because the method accepts an URL (even a local one), and because URLs don't have parameters, then it won't work for what is being attempted (even though opening an app without using parameters will work).

          RickW
          [www.smustard.com](http://www.smustard.com)

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

            @unknownuser said:

            Azuby - how it will look using your backtick? ๐Ÿ˜†

            Germans are not funny ๐Ÿ˜› , so I don't know, whether this is just fun question. Backticks are one of these little diacritic marks i.e. French use on "a", "e" and so on: "ร ", "รจ" ... Look my code above, I wrote **dir**. Between the backticks you write the call as you would write it in batch file or command line; for a coloured directory listing on Mac you could write ls -Glas or ls -G -l -a -s. If you do not need the result of the call, just information whether it failed or not, use the "system" call, if you want to get the result, than use backticks. And if you want to kill Sketchup, use "exec" ๐Ÿ˜‰

            azuby

            *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SUยฒCATT

            Bad English? PM me, correct me. :smile:**

            1 Reply Last reply Reply Quote 0
            • W Offline
              Whaat
              last edited by

              @unknownuser said:

              'Dos' window is visible in the background so it is not clean solution.

              I think if you use the command "start" before the name of the executable, the dos window will disappear after executing the batch file.

              start kerkythea.exe script.kst

              Whaat

              SketchUp Plugins for Professionals

              1 Reply Last reply Reply Quote 0
              • T Offline
                tomasz
                last edited by

                Thanks Azuby,
                Don't worry. I am not familiar with MACs at all. You are simply at the much higher level of programming then me, so most of what you are writing sounds like a Chinese to me ๐Ÿ˜„ I simply would like to start Kerkythea on MAC with start.kst file as a parameter (file to be opened when KT starts).
                By the way, next version of KT is expected in few months and it will be available for MAC!
                It is what Giannis says.

                Thanks Whaat,
                I have done some investigation and the line in the batch file should look like:
                start "" "C:\Program Files\Kerkythea\Kerkythea.exe" "start.kst"
                Now it works (PC only ๐Ÿ˜ž )!

                Tomasz

                Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                1 Reply Last reply Reply Quote 0
                • T Offline
                  tomasz
                  last edited by

                  Azuby, I have finally understood what you have written in you first post (I am not very familiar with standard Ruby methods). It works excellent with "dir", but for some reason KT is being opened only when I close SU otherwise SU is hanging and KT awaiting to start (edit - it takes about 40sec KT to start).

                  system("Kerkythea.exe start.kst")
                  
                  s=`Kerkythea.exe start.kst`
                  

                  works fine. Is it possible to run KT as a separate thread,
                  so SU would be still working?

                  Tomasz

                  Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

                  1 Reply Last reply Reply Quote 0
                  • T Offline
                    tomasz
                    last edited by

                    s=`c;/Program Files/Kerkythea/Kerkythea.exe "c;\\Program Files\\Kerkythea\\start.kst"`
                    

                    It is script that will run exe with parameter in "" (PC).
                    For MAC I presume I will have to replace all \ by /.

                    Still don't know how to keep SU alive when KT is running.

                    Tomasz

                    Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

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

                      Moin,

                      you can't do this with Ruby threads, they let Sketchup freeze while your other application is running. The code would be

                      Thread.new do `WHATEVER` end
                      

                      Also you can't use exec or fork. The only way would be writing a really simple server application, running it on localhost and call it from Sketchup.

                      azuby

                      *error initus :: Blocks | CurrentDate | d/Code | extensionmanager | FFlipper | HideEdges | MeasuredArea | ModelHistory | PluginsHelp | PronButton | SAWSO | SCP | SUยฒCATT

                      Bad English? PM me, correct me. :smile:**

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

                        Any ideas what's causing this glitch ?

                        help=Sketchup.find_support_file("RoofHelp.mht","Plugins/")
                        #=big file, but works...

                        help=Sketchup.find_support_file("RoofHelp.pdf","Plugins/")
                        #=small file, but not working ???

                        UI.messagebox("ERROR\nRoof Help File NOT found.") if not UI.openURL("file:///"+help)

                        On a PC with Vista UI.openURL will open almost any type of file except a PDF ?

                        This is delaying my beta issue of Roof.rb as it needs a help file !

                        TIG

                        1 Reply Last reply Reply Quote 0
                        • T Offline
                          tomasz
                          last edited by

                          The file name is case sensitive. Does it matter?
                          Try dir with the folder and look for the file.upcase.
                          Tomasz

                          Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

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

                            I don't think it's the case or another thought I had was even blank-spaces in paths (tried gsub 20% etc without any change in results).

                            It just seems to dislike PDF files - other types - mht, htm, doc, txt et al work OK...

                            Is it a setting in Vista ?

                            TIG

                            1 Reply Last reply Reply Quote 0
                            • T Offline
                              tomasz
                              last edited by

                              I have no idea. I am working on XP.

                              Author of [Thea Render for SketchUp](http://www.thearender.com/sketchup)

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

                                @unknownuser said:

                                I have no idea. I am working on XP.

                                Thanks anyway.

                                Just upgraded to a new PC - Core 2 Quad with 2Gb RAM - but it runs Vista...

                                Vista seems to be the problem...

                                TIG

                                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