added copy to clipboard for transcription
This commit is contained in:
parent
0526d6a9f6
commit
55df86b084
18
R2H2.lua
18
R2H2.lua
@ -1,4 +1,17 @@
|
|||||||
--functions
|
--functions
|
||||||
|
function CopyToClipboard(textString)
|
||||||
|
outClipFile, err = io.open("clipboardTempFile",'w')
|
||||||
|
if err then
|
||||||
|
print("[Error Opening Clipboard Temporary File for Writing]")
|
||||||
|
return
|
||||||
|
end
|
||||||
|
outClipFile:write(textString,'\n')
|
||||||
|
outClipFile:close()
|
||||||
|
command = 'cat "' .. "clipboardTempFile" .. '" | xclip -selection clipboard &'
|
||||||
|
os.execute(command)
|
||||||
|
os.execute("rm clipboardTempFile")
|
||||||
|
end
|
||||||
|
|
||||||
function PrintPosition(string)
|
function PrintPosition(string)
|
||||||
local print_text = ""
|
local print_text = ""
|
||||||
for i = 1, string.len(string) do
|
for i = 1, string.len(string) do
|
||||||
@ -41,11 +54,11 @@ function convertToHeonian(text)
|
|||||||
local transcribed = false
|
local transcribed = false
|
||||||
local transcribed_text = ""
|
local transcribed_text = ""
|
||||||
|
|
||||||
-- verbose?
|
|
||||||
local debug = false
|
local debug = false
|
||||||
|
local autocopy = false
|
||||||
for _, v in pairs(arg) do
|
for _, v in pairs(arg) do
|
||||||
if v == "-v" or v == "--verbose" then debug = true end
|
if v == "-v" or v == "--verbose" then debug = true end
|
||||||
|
if v == "-c" or v == "--copy" then autocopy = true end
|
||||||
end
|
end
|
||||||
|
|
||||||
-- we check if it's necessary to check anything at all
|
-- we check if it's necessary to check anything at all
|
||||||
@ -218,6 +231,7 @@ function convertToHeonian(text)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- output
|
-- output
|
||||||
|
if autocopy then CopyToClipboard(transcribed_text) end
|
||||||
return transcribed_text
|
return transcribed_text
|
||||||
end
|
end
|
||||||
end
|
end
|
Loading…
x
Reference in New Issue
Block a user