OpenInExplorer Tap to Space

This commit is contained in:
supertobi
2019-03-01 23:27:26 +01:00
committed by GitHub
parent 3df9040cfb
commit fa25ec4a26

View File

@@ -43,39 +43,39 @@ du.check_min_api_version("5.0.0", "OpenInExplorer")
--Detect OS and modify accordingly--
local proper_install = false
if dt.configuration.running_os == "windows" then
proper_install = true
proper_install = true
else
dt.print_error('OpenInExplorer plug-in only supports Windows OS at this time')
return
dt.print_error('OpenInExplorer plug-in only supports Windows OS at this time')
return
end
-- FUNCTION --
local function OpenInExplorer() --Open in Explorer
--Inits--
if not proper_install then
return
end
local images = dt.gui.selection()
local curr_image = ""
if #images == 0 then
dt.print('please select an image')
elseif #images <= 15 then
for _,image in pairs(images) do
curr_image = image.path..'\\'..image.filename
local run_cmd = "explorer.exe /select, "..curr_image
dt.print_log("OpenInExplorer run_cmd = "..run_cmd)
resp = dsys.external_command(run_cmd)
end
else
dt.print('please select fewer images (max 15)')
end
--Inits--
if not proper_install then
return
end
local images = dt.gui.selection()
local curr_image = ""
if #images == 0 then
dt.print('please select an image')
elseif #images <= 15 then
for _,image in pairs(images) do
curr_image = image.path..'\\'..image.filename
local run_cmd = "explorer.exe /select, "..curr_image
dt.print_log("OpenInExplorer run_cmd = "..run_cmd)
resp = dsys.external_command(run_cmd)
end
else
dt.print('please select fewer images (max 15)')
end
end
-- GUI --
if proper_install then
dt.gui.libs.image.register_action(
"show in file explorer",
function() OpenInExplorer() end,
"Opens File Explorer at the selected image's location"
)
dt.gui.libs.image.register_action(
"show in file explorer",
function() OpenInExplorer() end,
"Opens File Explorer at the selected image's location"
)
end