--[[ SETUP INSTRUCTIONS Temporarily save this file onto your desktop. Now you need to create a scripts folder: In Lightroom, choose Lightroom > Preferences (Mac OS) or Edit > Preferences (Windows). Choose the Preset tab and select Show All Other Lightroom Presets folder. Create a folder in the Lightroom folder called "Scripts". Copy this file into the Scripts folder. So you have a new folder called Scripts, and in it is this file. Quit and reopen Lightroom. You should now see a little scripts menu to the right of the Help menu with this file --]] local LrTasks = import 'LrTasks' local catalog = import "LrApplication".activeCatalog() local ProgressScope = import 'LrProgressScope' local LrDialogs = import 'LrDialogs' local LrView = import 'LrView' function split(str, pat) local t = {} if str == nil or str == "" or type(str)=="table" then return {str} end local fpat = "(.-)" .. pat local last_end = 1 local s, e, cap = str:find(fpat, 1) while s do if s ~= 1 or cap ~= "" then table.insert(t,cap) end last_end = e+1 s, e, cap = str:find(fpat, last_end) end if last_end <= #str then cap = str:sub(last_end) table.insert(t, cap) end return t end LrTasks.startAsyncTask( function() local photo=catalog:getTargetPhoto() varFiles = {} varFiles[#varFiles+1] = photo:getFormattedMetadata('title') varFiles[#varFiles+1] = photo:getFormattedMetadata('caption') varFiles[#varFiles+1] = "" keys = split( photo:getFormattedMetadata('keywordTagsForExport') ,", ") keyStr = {} for k , key in pairs(keys) do keyStr[#keyStr +1] = "#"..string.gsub(key," ", "") end varFiles[#varFiles+1] = table.concat(keyStr, " ") .. " #fujifilm #fujifilmuk #lightroom" varFile = table.concat(varFiles, "\n") local f = LrView.osFactory() local c = f:row{ bind_to_object = props, f:column { f:edit_field { value = varFile, width_in_chars = 40, height_in_lines = 10 }, }, } dialogValue = LrDialogs.presentModalDialog( { title = "Copy to Instagram" , contents = c, } ) end)