Graphics

 View Only
  • 1.  engine.projectpath command

    Posted 03-13-2020 18:12

    Is there a way to use the engine.projectpath command without it being dependent a project being active in the Project Manager?  I have the following script:

    'declare variables
    dim baseobj as xpbaseobject
    dim state as xpTextObject

    'get scene objects
    Self.getobjectbyname("State", baseobj)
    Self.getobjectbyname("Selected State", state)

    'set state icon
    baseobj.SetVolatileTextureFile(0, engine.ProjectPath & "Images\States\" & state.text & ".png")

    This works so long as the project is active.  Our stations will generally have multiple projects loaded at once, so there is no guarantee that the project using this script will be active.  I thought about using engine.GetProjectByName, but because the project name changes every time I do an increment and save I would have to go in and update this script every time I update the project.  Any advice would be greatly appreciated.  Thanks.



  • 2.  RE: engine.projectpath command

    Posted 03-16-2020 11:49

    Hi John

    Have you tried using Engine.GetProject instead? Not sure how the indexing of the projects would work, but the chances are they'll remain the same even after a save.  The xpProject object you'd get back has a ProjectPath property which might help.

    How is your script being called? Have you considered using Global Scripts as well?

     

    Simon


    #XPression


  • 3.  RE: engine.projectpath command

    Posted 04-09-2020 17:30

    You could also try Scene.Project.ProjectPath or it looks like in your case Self.Project.ProjectPath

    That will return the project path of the project containing the scene.


    #XPression