Copy Full Name, Directory or File Name to Clipboard
Posted: Thu Sep 04, 2008 1:43 am
Here are three macros that copy parts of the active document to the clipboard.
Code: Select all
--
-- Name: Copy Fully Qualified Filename to Clipboard
--
-- Author: Jussi Jumppanen
--
-- Language: Lua Macro
--
-- Description: This Lua macro copies the fully qualified name
-- of the active document to the windows clipboard.
--
function key_macro()
-- macro only works for documents
local document = is_document()
if document > 0 then
local file_name = macro_tag("$fn")
set_clipboard_text(file_name)
message("'" .. file_name .. "' text added to clipboard.")
else
message("This macro only works for document files!")
beep()
end
end
key_macro() -- run the macro
Code: Select all
--
-- Name: Copy File Drive and Directory to Clipboard
--
-- Author: Jussi Jumppanen
--
-- Language: Lua Macro
--
-- Description: This Lua macro copies the drive and directory
-- of the active document to the windows
-- clipboard.
--
function key_macro()
-- macro only works for documents
local document = is_document()
if document > 0 then
local file_name = macro_tag("$fdd")
set_clipboard_text(file_name)
message("'" .. file_name .. "' text added to clipboard.")
else
message("This macro only works for document files!")
beep()
end
end
key_macro() -- run the macro
Code: Select all
--
-- Name: Copy File Name to Clipboard
--
-- Author: Jussi Jumppanen
--
-- Language: Lua Macro
--
-- Description: This Lua macro copies the file name of the
-- active document to the windows clipboard.
--
function key_macro()
-- macro only works for documents
local document = is_document()
if document > 0 then
local file_name = macro_tag("$f")
set_clipboard_text(file_name)
message("'" .. file_name .. "' text added to clipboard.")
else
message("This macro only works for document files!")
beep()
end
end
key_macro() -- run the macro