Jump to: Board index » General » Fusion

Relative Path for Execute

Learn about 3D compositing, animation, broadcast design and VFX workflows.
  • Author
  • Message
Offline

John Holt

  • Posts: 197
  • Joined: Sat Mar 02, 2019 8:54 pm
  • Real Name: John Holt

Relative Path for Execute

PostTue Aug 03, 2021 8:02 pm

I am attempting to get a local html page opened from within an Edit Controls Button and I am getting very confused with path maps.

"os.execute ("start ../galleries/gallery.html" )" using this code in execute opens up the gallery.html as long as it is in C:\Program Files\Blackmagic Design\galleries.

However I am looking to use the Comps: path so I am able to place the galleries folder in #:\Documents\Blackmagic Design\Fusion. I wish to use the Comps: so it will open on another computer. I have read through the pathMap posts but unfortunately can not find my answer. Any help would be appreciated.

"os.execute ("start ../Comps:galleries/gallery.html" )" Doesn't work, I know I am getting the syntax wrong. the correct one would blow me away. TIA
Windows 10 Pro
AMD Ryzen 5 3600 6-Core Processor 3.60 GHz
64GB RAM
GTX1650 4GB :(
Samsung SSD 970 EVO Plus 1TB 1000.2 GB
Dual Monitors 32" & 27" Samsung
BM Multidock
Speed Editor
DR Studio Latest Version Fusion Studio Latest Version
Offline
User avatar

Bryan Ray

  • Posts: 2478
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Relative Path for Execute

PostTue Aug 03, 2021 8:44 pm

You don't need the leading "../".
Comps: points to the UserData folder, so this should work:

"os.execute ("start Comps:galleries/gallery.html")"

Capture.JPG
Capture.JPG (31.27 KiB) Viewed 1969 times
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

John Holt

  • Posts: 197
  • Joined: Sat Mar 02, 2019 8:54 pm
  • Real Name: John Holt

Re: Relative Path for Execute

PostTue Aug 03, 2021 9:50 pm

Hi

Spot on with that answer thanks, although I now have another issue. So it looks like I will have to stick with placing it in the program folder which isn't ideal.

My new issue is it won't launch the default browser. I think I will have to sleep on it.

Your help is greatly appreciated.
Windows 10 Pro
AMD Ryzen 5 3600 6-Core Processor 3.60 GHz
64GB RAM
GTX1650 4GB :(
Samsung SSD 970 EVO Plus 1TB 1000.2 GB
Dual Monitors 32" & 27" Samsung
BM Multidock
Speed Editor
DR Studio Latest Version Fusion Studio Latest Version
Offline
User avatar

Peter Loveday

Blackmagic Design

  • Posts: 24
  • Joined: Tue Sep 30, 2014 6:23 am

Re: Relative Path for Execute

PostWed Aug 04, 2021 4:48 am

Have you tried:
Code: Select all
bmd.openurl("file://" .. comp:MapPath("Comps:galleries/gallery.html"))
Love, Light and Peace,
- Peter Loveday
Offline

John Holt

  • Posts: 197
  • Joined: Sat Mar 02, 2019 8:54 pm
  • Real Name: John Holt

Re: Relative Path for Execute

PostWed Aug 04, 2021 6:06 am

Hello

Peter you are amazing, where do I send the check.

bmd.openurl("file://" .. comp:MapPath("Comps:galleries/gallery.html"))

Worked a charm.

Whilst I think about it how could I open a pdf at the same location. I tried

bmd.openfileexternal('Open', .. comp:MapPath("Comps:pdf.pdf")) obviously I again have the syntax incorrect.

TIA
Windows 10 Pro
AMD Ryzen 5 3600 6-Core Processor 3.60 GHz
64GB RAM
GTX1650 4GB :(
Samsung SSD 970 EVO Plus 1TB 1000.2 GB
Dual Monitors 32" & 27" Samsung
BM Multidock
Speed Editor
DR Studio Latest Version Fusion Studio Latest Version
Offline
User avatar

Bryan Ray

  • Posts: 2478
  • Joined: Mon Nov 28, 2016 5:32 am
  • Location: Los Angeles, CA, USA

Re: Relative Path for Execute

PostWed Aug 04, 2021 3:43 pm

The .. operator is used for joining strings together. It's present in Peter's example because it's combining the two strings "file://" and the result of MapPath(). You're not trying to join the two arguments of openfileexternal() that way—that would be nonsensical, so you'll get an error from not having a string segment before that operator.

I recommend keeping Programming in Lua handy. I have a hardcopy of the book on my desk at all times, but the first edition is available for free on the web:
https://www.lua.org/pil/contents.html#3

Section 3.4 deals with the string concatenation operator.

edit: Also, hi Peter! Good to see you in here!
Bryan Ray
http://www.bryanray.name
http://www.sidefx.com
Offline

John Holt

  • Posts: 197
  • Joined: Sat Mar 02, 2019 8:54 pm
  • Real Name: John Holt

Re: Relative Path for Execute

PostWed Aug 04, 2021 5:56 pm

Hello

Thank you, I also have a hard copy of Programming in Lua 4th edition & the reference manual but as yet the penny hasn't dropped. I shall re-read Section 3.4 then the rest of the book again.

Appreciate your help, I'll get there.
Windows 10 Pro
AMD Ryzen 5 3600 6-Core Processor 3.60 GHz
64GB RAM
GTX1650 4GB :(
Samsung SSD 970 EVO Plus 1TB 1000.2 GB
Dual Monitors 32" & 27" Samsung
BM Multidock
Speed Editor
DR Studio Latest Version Fusion Studio Latest Version

Return to Fusion

Who is online

Users browsing this forum: marcokal and 30 guests