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
|
||||
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)
|
||||
local print_text = ""
|
||||
for i = 1, string.len(string) do
|
||||
@ -41,11 +54,11 @@ function convertToHeonian(text)
|
||||
local transcribed = false
|
||||
local transcribed_text = ""
|
||||
|
||||
-- verbose?
|
||||
local debug = false
|
||||
|
||||
local autocopy = false
|
||||
for _, v in pairs(arg) do
|
||||
if v == "-v" or v == "--verbose" then debug = true end
|
||||
if v == "-c" or v == "--copy" then autocopy = true end
|
||||
end
|
||||
|
||||
-- we check if it's necessary to check anything at all
|
||||
@ -218,6 +231,7 @@ function convertToHeonian(text)
|
||||
end
|
||||
|
||||
-- output
|
||||
if autocopy then CopyToClipboard(transcribed_text) end
|
||||
return transcribed_text
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user