local cursorPos = reaper.GetCursorPosition()
cursorPos = cursorPos + 1
reaper.SetEditCurPos(cursorPos, false, false)
希望这个脚本有一个控制窗口(或者说悬浮窗口)可以随时设置需要移动的秒数。
但并不是每运行一次都需要输入的那种窗口
请问有大佬可以解决吗?
local cursorPos = reaper.GetCursorPosition()
cursorPos = cursorPos + 1
reaper.SetEditCurPos(cursorPos, false, false)
希望这个脚本有一个控制窗口(或者说悬浮窗口)可以随时设置需要移动的秒数。
但并不是每运行一次都需要输入的那种窗口
请问有大佬可以解决吗?
local cursorPos = reaper.GetCursorPosition()
retval, csv = reaper.GetUserInputs('input', 1, '需要移动的秒数', '0')
if retval then
csv = tonumber(csv)
if csv then
cursorPos = cursorPos + csv
reaper.SetEditCurPos(cursorPos, false, false)
end
end
感谢大神!~ 但是不是想要这种每次都弹窗的窗口,是不影响操作的可以长时间悬浮的窗口
你的详细想法,构思?操作流程?
正好我用Scythe library v3编了一个GetUserInput的简单GUI,你可以将这个窗口一直悬浮,随时输入需要的值,按“确定”执行,按“取消”退出。运行效果如下:
代码如下,供你你参考(前提是需要通过Reapack安装Scythe库):
local libPath = reaper.GetExtState("Scythe v3", "libPath")
if not libPath or libPath == "" then
reaper.MB("Couldn't load the Scythe library. Please install 'Scythe library v3' from ReaPack, then run 'Script: Scythe_Set v3 library path.lua' in your Action List.", "Whoops!", 0)
return
end
loadfile(libPath .. "scythe.lua")()
local GUI = require("gui.core")
function somefunc()
end
local window = GUI.createWindow({
name = "我的输入对话框",
w = 320,
h = 192,
})
local layer = GUI.createLayer(
{
name = "My Layer"
}
)
local button1 = GUI.createElement(
{
name = "BT_OK",
type = "Button",
x = 60,
y = 130,
w = 80,
h = 30,
caption = "确定"
}
)
local button2 = GUI.createElement(
{
name = "BT_CL",
type = "Button",
x = 170,
y = 130,
w = 80,
h = 30,
caption = "取消"
}
)
local txtbox1 = GUI.createElement(
{
name = "TXT1",
type = "Textbox",
x = 160,
y = 30,
w = 80,
h = 25,
caption = "输入一个值:",
captionPosition = "left",
pad = 5
}
)
--按下“确定”按钮后执行的函数
button1.func = function()
--文字框返回的值
local val=txtbox1.retval
local cursorPos = reaper.GetCursorPosition()
cursorPos = cursorPos + val
reaper.SetEditCurPos(cursorPos, false, false)
end
--按下“取消”按钮后退出
button2.func = function()
window:close()
end
layer:addElements(button1)
layer:addElements(button2)
layer:addElements(txtbox1)
window:addLayers(layer)
window:open()
GUI.Main()