Run bat and javascript with external command

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Run bat and javascript with external command

    Hi I have an external command which runs a .bat file. This bat file opens the software 3DR and then it runs a javascript. Unfortunately, it does not run the javascript which is called in the .bat file.....

    the .bat file does work and calls the javascript when I run it from windows explorer, however, it does not run from the external command within pcdmis.

    Any suggestions?

  • #2
    Post the .bat and the calling code from PC-DMIS. Maybe the PC-DMIS command is waiting (indefinitely) for 3DR to close before continuing (running the Javascript)?
    PC-DMIS CAD++ 2o19 R1 SP11

    Comment


    • #3
      Originally posted by MihaelR View Post
      the .bat file does work and calls the javascript when I run it from windows explorer, however, it does not run from the external command within pcdmis.
      Do you run PC-DMIS as Administrator? Windows has some special rules when an Admin user spawns new processes or loads .dll:s - the files will only be loaded if they reside in a 'trusted' folder, or some such (I don't know exactly how it works, only that it can make things different when you run with admin rights).
      AndersI
      SW support - Hexagon Metrology Nordic AB

      Comment


      • Peter Fuller
        Peter Fuller commented
        Editing a comment
        +1 There is a good chance the Java script requires elevation that it isn't getting when PC-DMIS is spawned as a normal user.

    • #4
      Hi All,

      vpt.se here is the code

      Code:
      "C:\\Program Files\\3DReshaper_18.1_x64\\3DRshp.exe" ^
      --script="./MeasureVolume-Auto.js" ^
      --silent --ScriptAutorun ^
      --scriptParam="var Folder = 'C:\\PC-DMIS Data\\measure routines\\V2019 R1\\volume'; var ASCIIFile = 'COP_MOLD.XYZ';"
      AndersI Yes I have tried running PC-DMIS with admin rights, but this did not the trick.. Also checked everything in regedit and seemed oke.

      Comment


      • Peter Fuller
        Peter Fuller commented
        Editing a comment
        Have you tried setting the compatibility options for the .bat file to run as admin? Like I said earlier it's probably the script function that's not getting the correct permission to start. So setting the .BAT to run as admin might allow the console to execute it properly.

    • #5
      Okay, I have it working now. The problem was the following..

      Running a .bat from windows explorer works, however, when you run a .bat in PC-DMIS, then make sure that you have all the paths written in the .bat or .exe script. Normally when you run a .bat it can call scripts as long it is in the same folder. In this case it is run from PC-DMIS and it is not longer in the windows folder and needs the folder paths to find other scripts to run.

      Thanks for the support all. Great forum.

      Comment


      • #6
        Thanks for posting your solution!
        PC-DMIS 2016.0 SP8

        Jeff

        Comment

        Related Topics

        Collapse

        Working...
        X