Skip to content

Instantly share code, notes, and snippets.

@vurdalakov
Created March 8, 2018 09:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vurdalakov/6a86e51f643e9ad300824cb184988bb3 to your computer and use it in GitHub Desktop.
Save vurdalakov/6a86e51f643e9ad300824cb184988bb3 to your computer and use it in GitHub Desktop.
Lightroom plugin template

How to create an empty Lightroom plugin

  1. Create a directory with .lrplugin extension anywhere on your disk, e.g. LightroomPluginTemplate.lrplugin.
  2. Copy there attached Info.lua file (don't change its name).
  3. Copy there attached LightroomPluginTemplate.lua file.
  4. Start or switch to Lightroom.
  5. Click File menu and then PLug-in Manager menu item.
  6. Click Add button in bottom left of the Lightroom Plug-in Manager dialog.
  7. Find and select LightroomPluginTemplate.lrplugin folder and click Selectt Folder button.
  8. Click Done button to click the dialog. Now your plugin is installed.
  9. Click File menu, then PLug-in Extras menu item and then Show Lightroom version menu item under Lightroom Plugin Template section.
  10. You will see a message box reposting Lightroom detailed version number.
return {
LrSdkVersion = 6.0,
LrSdkMinimumVersion = 6.0,
LrToolkitIdentifier = 'net.vurdalakov.lightroomplugintemplate',
LrPluginName = 'Lightroom Plugin Template',
LrExportMenuItems = {
title = "Show Lightroom &version",
file = "LightroomPluginTemplate.lua",
enabledWhen = "photosSelected"
}
}
local LrApplication = import 'LrApplication'
local LrTasks = import 'LrTasks'
local LrDialogs = import 'LrDialogs'
-- enable logging (in Documents folder)
local LrLogger = import 'LrLogger'
local logger = LrLogger('LightroomPluginTemplate')
--logger:enable("logfile") -- log to LightroomPluginTemplate.log file in Documents folder
logger:enable("print") -- log to debug output
logger:trace("This is LightroomPluginTemplate plugin")
-- async task
LrTasks.startAsyncTask (function()
logger:trace("Async task")
end)
local version = LrApplication.versionTable()
local versionString = string.format("Lightroom version %d.%d revision %d build %d", version.major, version.minor, version.revision, version.build)
logger:trace(versionString)
LrDialogs.message(versionString)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment