Recent Posts

Expression Builder Plugin V2.0

Overview Installation UI Overview Expression Builder Open / Load Save Copy Search Page Keywords Copy Glossary Categories Copy to Clipboard Hints Links Expression Builder is for Davinci Resolve Studio version 18. Expression Builder lite will be available soon for Davinci Resolve. Overview Expression Builder assists those learning Fusion Expressions and contains hundreds of examples, however, expressions can be almost limitless and we are adding more every day. New expressions will be available through or update schedule, which is why it is important to include your correct email address. The plugin is capable of saving and loading your own custom expressions for modification or reuse. Expressions can be saved as a .txt .setting or .comp file but must be given a name and extension prior to 'save'. If you wish to contribute your expressions to be included in a future update then you can do so here. Submit an Expression Download and Installation Extract the Expression Builder zip f

Adding a Button in a Macro

Why on earth would we want a button in a macro?

A button can run any OS command, so you can do a lot. I am however going to keep this practical and for all the people out there that make macros for others. Our button will open a webpage, this webpage could be your website or even a YouTube video with instructions.

NB. A button can execute a script, run a fuse, or any known operating system command.

Adding a button is the same as adding a label or drop-down and can be completed inside resolve. However, you may want to edit the code to ensure the button works correctly on both Mac & Windows. Also, we can move the button to any location via the code.

Assumptions

  • You are on the fusion page
  • You are either modifying an existing tool/effect or creating your own.
  • The result will be a GroupOperator/MacroOperator
  • The result can be for fusion, edit page, or cut page.

  1. Select the node you want the Button on.
  2. Right-click and choose "Edit Controls"
  3. Over Type Name: "New Contol" with your button title
  4. Leave "Type" as "Number"
  5. Select the "Page" you want the label to be on (User)
  6. Uncheck "Animatable"
  7. Check "Passive"
  8. Input Crtl select ButtonControl
  9. Enter in the Execute box "os.execute('start "" "your url"') --Windows
  10. Select "OK"
9A. Enter "os.execute('open "" "your url"') --Mac
10. Select "OK"

The button will now appear at the bottom of the inspector on the page you selected. As long as the URL you entered is correct when you click on the button, the default web browser will open and navigate to it. The computer terminal or command prompt will flash on the screen for a millisecond as we have just triggered an OS command.


Hold the phone! What if you don't know the operating system this will be used on, well we are back to coding. (Although I have read that "open" will work on Mac or Windows).

The section of code we need to tweak will be the section created when we went into "Edit Controls" This generates the section called UserControls.

  1.                                   UserControls = ordered() {
  2. Button = {
  3. LINKS_Name = "Button",
  4. LINKID_DataType = "Number",
  5. INPID_InputControl = "ButtonControl",
  6. INP_Integer = false,
  7. INP_External = false,
  8. INP_Passive = true,
  9. BTNCS_Execute = [[
  10.                     os.execute('open "" "https://www.blackmagicdesign.com/"')
  11.                     os.execute('start "" "https://www.blackmagicdesign.com/"')
  12.                     ]],
  13. },
Adding lines 9, 10, 11 & 12 sets the button to open in Mac or Windows.

BTNCS_Execute = is a powerful command and can run almost anything.

The URL does not have to be a webpage it can also be a file path on the computer, so you could open a local webpage or a pdf file. 

If you require 2 buttons then just add another button to the same node, and then set the "width" to 0.5. width is above the execute box.


That's it!

Thanks for taking the time to read this post and if you would like to buy me a coffee, pizza, narrowboat then it is greatly appreciated.






Comments

  1. NIce. I learn a lot by reading your post.
    Many Thanks

    ReplyDelete
    Replies
    1. Thanks for reading the post. I have started a new website resolvebrowser.co.uk which includes more tips and tricks. Enjoy!

      Delete

Post a Comment

Popular posts from this blog

DaVinci Resolve Expressions

Expression Builder Plugin V2.0

Organising The Fonts Folder