Q100576: How to set the default application used to open .nk files to either Nuke or NukeX

Follow

SUMMARY

When launching Nuke scripts by double-clicking the icon, they generally launch with the latest installed version. This article explains how to update the default settings for opening .nk scripts in any specified version, and by which Nuke product it launches, either Nuke or NukeX.

 

MORE INFORMATION

Windows

Launching Nuke by double-clicking the script can save time, and when doing so, the user expects a specific version or product to open. In Windows, this can be achieved by editing the Windows Registry.

There have also been reports that fresh installs of Nuke versions 12.0v1 and above are missing the Nuke Script (.nk) file associations. This bug has been logged in our bug database as:

ID 437042 - Nuke no longer registers Nuke Scripts to an associated program when installed in Windows.

This was addressed in Nuke 12.2v6 and 13.0v2, so if you install those versions of Nuke or newer, then Nuke scripts should open in the last version of Nuke you installed.


Additionally, recent Windows Updates have gone out (post 1903), that may have changed the way Nuke is able to set the default .nk script launching. If this is the case, please scroll to the end of the Windows section titled 1906 UPDATE.

 

WARNING: Please keep in mind that if any incorrect changes are made in the Registry, this could adversely affect your machine, proceed at your own risk. If you feel comfortable in changing your computer's settings via the Registry, as an Administrator, please do the following:

 1. From the Start menu, type regedit and press Enter on the keyboard to launch the Registry Editor program.

2. At the address bar, copy and paste the following: Computer\HKEY_CLASSES_ROOT\NukeScript\shell\open\command​
  

3. Double-click the (Default) value in the Name category to edit the data.      ​

4. If Nuke was installed to a default location, copy/paste the following text, and then press OK:
"C:\Program Files\Nuke15.1v1\Nuke15.1.exe" --nukex "%1"​
   If Nuke is installed to a custom location, then locate the installed directory and use that path with:
Nuke15.1.exe" --nukex "%1"​

5. Double-click any .nk file to launch with NukeX 15.1v1.

      NOTE: When following the steps above, this will change the registry defaults to always launch NukeX 14.0v5 with any .nk script. You can edit the Data value to be for any installed Nuke version.

The steps above can also be applied for .hrox Studio/Hiero projects by using the following path: Computer\HKEY_CLASSES_ROOT\NukeStudioProject\shell\open\command

   

      For Studio or Hiero, ensure the --studio or --hiero flags are used:
"C:\Program Files\Nuke15.1v1\Nuke15.1.exe" --hiero "%1"​

      NOTE: If you did not want to manually edit the Windows Registry, please download the attached file that when double-clicked, will automatically append the values for you using NukeX 15.1v1 and Nuke Studio 15.1v1, as long as Nuke was installed to the default directory. Additionally, once the Registry has been edited with the above changes, Nuke will no longer update the default for current installations, and will manually need to be changed per version.


1906 UPDATE

With some more recent versions of Windows (1906+), default applications are unable to be set with the attached .reg file, or by manually adding the above information. The issue has been overcome by adding the .nk Default entry Data value as "NukeScript", then deleting the UserChoice directory, as shown here:

To have more recent versions of Windows 10 allow updating the default .nk launching application, please do the following:

1. From the Start menu, type regedit and press Enter on the keyboard to launch the Registry Editor program.

2. Navigate to the following path: Computer\HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.nk

3. Locate the .nk extension and fully expand the directory.

4. Delete the UserChoice directory. (It may be beneficial to first make a backup by exporting the folder. Right-click and select Export, give it a name and save the file)

5. Then, navigate to: Computer\HKEY_CLASSES_ROOT\.nk

6. Ensure the .nk directory is selected, and that the Default Name value has the Data value "NukeScript", as shown here:

NOTE: If the Default Data value is anything other than NukeScript, change it by double-clicking the Default Name and entering the text, then pressing OK.

   

After removing the UserChoice directory and adding the NukeScript Data value to the .nk Default, you should now be able to run the attached .reg file for updating the Default Nuke application when double-clicking .nk files. Please get in contact with Support if you run into issues with performing the above.

macOS

On macOS, the process is different than Windows for setting the default launch application. Please perform the following to update the default Nuke application when double-clicking the .nk script:

  1. Locate and right-click on a Nuke script that has the .nk extension.
  2. In the context menu select Get Info.
  3. Click Open With to expand the selection.
  4. Select the application dropdown and choose any installed Nuke application as a preference.
  5. Click Change All… and then Continue to set the default application.

 NOTE:  Double-clicking the .nk scripts will now open it with the default application. This procedure can also be used for .hrox Nuke Studio/Hiero project files as needed.

       

 NOTE: The default application settings on macOS are only changed per User Account.

 

Linux [CentOS 7/Rocky 9]

For the Linux distributions, Nuke has its own mime type (application/x-nuke), which will need to be added to a file list in a specific directory before being able to double-click .nk scripts for launching Nuke. More information on this can be found in the Further Reading section. Please perform the following to launch .nk scripts on the Linux platform:

 NOTE: Please keep in mind that this was tested on CentOS 7 with the GNOME desktop environment. Other desktop environments and file locations may vary. 

  1. In Terminal, change to the following directory: /usr/share/mime/packages
  2. As sudo, open any terminal text editor such as nano or vim, and create a file called “applications-x-nuke.xml”. Example: sudo nano applications-x-nuke.xml
  3. Copy/paste the following code:
<?xml version="1.0" encoding="UTF-8"?>
<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info">
<mime-type type="application/x-nuke">
<comment>NukeScript</comment>
<glob pattern="*.nk"/>
</mime-type>
</mime-info>
  1. Save and exit the .xml file (Ctrl+O, then Ctrl+X in nano)
  2. Update the mime database to ensure it takes effect: sudo update-mime-database /usr/share/mime
  3. Then update the application database: sudo update-desktop-database /usr/share/applications
  4. Copy the created .xml file to ~/.local/share/mime/packages/ with the command:
    sudo cp applications-x-nuke.xml ~/.local/share/mime/packages/

    NOTE: There’s a chance that the /mime/packages/ directory is not already available. In this instance, run the following command to create the directories first, before copying the file over: mkdir -p ~/.local/share/mime/packages/
  5. Update the mime database for that location: sudo update-mime-database ~/.local/share/mime
  6. Update the application database: sudo update-desktop-database ~/.local/share/applications
  7. Log out of the current user, and then log back in to apply any changes made.

 NOTE: There may be errors related to other Linux mime-types when updating the mime databases, as shown in the screenshot below. These can be ignored for the purpose of creating the applications/x-nuke mime type. Please view the Further Reading section for more information on the update-mime-database and update-desktop-database commands.
 

 

As of Nuke 12, Nuke no longer creates shortcuts when being installed, so shortcuts will need to be created manually. A feature request to change this behaviour is logged as: ID 162266 - Add the ability to control which Desktop Icons are installed/added to the desktop

Shortcuts can be created by:

  1. In Terminal, change to the following directory: /usr/share/applications/
  2. As sudo, open any terminal text editor such as nano or vim, and create a file called “Nuke14.0v5.desktop”. Example: sudo nano Nuke15.1v1.desktop
  3. Copy/paste the following code:
[Desktop Entry]
Name=Nuke15.1v1
Comment=
Exec="/usr/local/Nuke15.1v1/Nuke15.1" --nukex -b %f
Terminal=false
MimeType=application/x-nuke;
Icon=/usr/local/Nuke15.1v1/plugins/icons/NukeApp48.png
Type=Application
Categories=Graphics;2DGraphics;RasterGraphics;FLTK;
  1. Save and exit the .desktop file (Ctrl+O, then Ctrl+X in nano)

More information about creating shortcuts on linux can be found here: Q100521: Creating a desktop shortcut on Linux operating systems

 It may also be necessary to add or adjust the application/x-nuke mime type in the mimeapps.list. Please edit the list with the following command in terminal: nano ~/.config/mimeapps.list

Then if they are not already available, please add the following lines to the [Added Associations] and [Default Applications] list for your latest version of Nuke, as shown in the screenshot below:
application/x-nuke=Nuke15.1v1.desktop;
application/x-nuke=Nuke15.1v1.desktop;

 

The .nk script should now be associated with the desired application, and when double-clicked, launch the correct version.

As an alternative method in Linux with the GNOME desktop, and as long as the mime-type was registered, you can perform the following for opening the .nk script with Nuke as a default application:

  1. Right-click the associated file type (.nk)
  2. Select Open With Other Application.
  3. Click any Nuke or NukeX application and press Select.

NOTE: Please keep in mind that doing this method may change the behavior of other default applications of the same type (i.e plain text document). If you do not want other text files opened with Nuke, instead of setting it as Default, just right-click the Nuke Script and select Open with Application > Nuke, or set the mime-type from the first method.

 

FURTHER READING 

 

FURTHER HELP

If you are still experiencing issues after trying the provided steps above, please open a Support request and let us know the exact issue encountered and the troubleshooting steps that have been taken. 

For more information on how to open a Support request, please refer to this article: Q100064: How to raise a support ticket 

 

Attachments:

We're sorry to hear that

Please tell us why