Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local mp = require 'mp'
- local clipboard = require 'utilities.clipboard'
- function load_file_from_clipboard()
- local content = clipboard.get_clipboard(true)
- if content and content ~= '' and content ~= 'error' then
- mp.osd_message('Opening file: ' .. content)
- mp.commandv('loadfile', content, 'replace')
- elseif(content == 'error') then
- mp.osd_message('Error getting clipboard contents!')
- else
- mp.osd_message('Clipboard is empty, or not a string')
- end
- end
- function append_file_from_clipboard()
- local content = clipboard.get_clipboard(true)
- if content and content ~= '' and content ~= 'error' then
- mp.osd_message('Appending file: ' .. content)
- mp.commandv('loadfile', content, 'append-play')
- elseif(content == 'error') then
- mp.osd_message('Error getting clipboard contents!')
- else
- mp.osd_message('Clipboard is empty, or not a string')
- end
- end
- function copy_file_path_to_clipboard()
- local filename = mp.get_property('path')
- if filename then
- mp.osd_message('Filename copied to clipboard: ' .. filename)
- clipboard.set_clipboard(filename)
- else
- mp.osd_message('No file')
- end
- end
- mp.register_script_message('load_file_from_clipboard', load_file_from_clipboard)
- mp.register_script_message('append_file_from_clipboard', append_file_from_clipboard)
- mp.register_script_message('copy_file_path_to_clipboard', copy_file_path_to_clipboard)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement