Scripting via PHP

Get answers to your questions about color grading, editing and finishing with DaVinci Resolve.
  • Author
  • Message
Offline

tacman1123

  • Posts: 36
  • Joined: Tue Sep 25, 2018 4:18 pm
  • Real Name: Tac Tacelosky

Scripting via PHP

PostWed Oct 10, 2018 12:20 pm

Is it possible to script via PHP on Windows? I'm having so much trouble with Python (because I'm so new to it) that I figured I'd give PHP a try.

I tried registering it as a service:

C:\Windows\system32\regsvr32 "c:\Program Files\Blackmagic Design\DaVinci Resolve\fusionscript.dll"

So that I could call it with the

$resolve = new COM('C:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll');

but no luck. I'm stabbing in the dark here, figuring that if it's accessible via Python 2/3 and Lua, that maybe it's available via PHP and other languages.

I'm making some progress on Python, although what I've done feels like a complete hack. In particular, the documentation says to use introspection to figure out the API calls, but I don't know how to do that in Python, so I'm limited to the subset that's available in the one-page documentation on scripting.

I'd love to get a handle on scripting, I think it has enormous potential, which is why I keep at it.

Suggestions?
Offline

Hendrik Proosa

  • Posts: 3053
  • Joined: Wed Aug 22, 2012 6:53 am
  • Location: Estonia

Re: Scripting via PHP

PostWed Oct 10, 2018 1:40 pm

I have only mild experience with COM and OLE stuff but I think you can't create a COM object from random dll, it must declare COM interfaces for it to work. And if COM interfaces for Resolve are declared in system, you should probably reference them directly by their ID...

For python introspection see this doc: http://book.pythontips.com/en/latest/ob ... ction.html
Basically you can query the members of any python object/variable whatnot.
I do stuff
Offline

tacman1123

  • Posts: 36
  • Joined: Tue Sep 25, 2018 4:18 pm
  • Real Name: Tac Tacelosky

Re: Scripting via PHP

PostWed Oct 10, 2018 2:02 pm

Thanks, I didn't think so, but figured I'd give it a try.

Regarding dir(), what am I doing wrong here?

Code: Select all
smodule = imp.load_dynamic('fusionscript', 'C:\\Program Files\\Blackmagic Design\\DaVinci Resolve\\fusionscript.dll')
resolve = smodule.scriptapp('Resolve')
dir(resolve)

# These calls work, so resolve is loaded okay
projectManager = resolve.GetProjectManager()
project = projectManager.GetCurrentProject()



I'm able to use resolve, but dir simply prints out an empty array, and on introspection in the debugging, it's also an array.

Thanks,

Tac

Return to DaVinci Resolve

Who is online

Users browsing this forum: 4EvrYng, Bing [Bot], Google [Bot], Leslie Wand, norellajanine, panos_mts and 260 guests