View Single Post
Old 01-09-2019, 10:20 AM   #6
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,062
Default

Quote:
Originally Posted by Eliseat View Post
Code:
function click_SAVE()
	local input = vlc.object.input()
	if input then
		local curtime=vlc.var.get(input, "time")
		local curtime=math.floor(curtime/1000)
		local curtime=curtime/1000
		local hours = math.floor(curtime/3600)
		local minutes = math.floor((curtime%3600)/60)
		local seconds = math.floor(curtime%60)
		number = 1
		if number % 2 == 0
          then
              local timeString = string.format("%02d:%02d:%02d-",hours,minutes,seconds)
          else
              local timeString = string.format("%02d:%02d:%02d,",hours,minutes,seconds)
        end
        number = number + 1
		w2:set_text(timeString)
		save_to_clipboard(timeString)
	end
end
I tried this but it doesn't copy anything into the clipboard.
You declare timeString as a local variable inside the if else statements, so the code outside that won't see the initialized string.

But if you fix that, the logic still of course doesn't fully work since you initialize the number to 1 each time the function is executed.
__________________
I am no longer part of the REAPER community. Please don't contact me with any REAPER-related issues.
Xenakios is offline   Reply With Quote