Go Back   Cockos Incorporated Forums > REAPER Forums > REAPER General Discussion Forum

Reply
 
Thread Tools Display Modes
Old 10-21-2018, 03:22 PM   #1
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default Can Reaper do this with scripts?

I LOVE Reaper. I love how it's so versatile with a vast array of possibilities and other things. But sadly, I am not fluent in Python, Lua, or Eel, and before I can even start down the path of trying to learn any of these languages, perhaps I should ask what can and can't be done in Reaper.

Background:
My church uses the Berhinger X32 Compact mixer that is tied directly into my computer to record everything from just before service starts to the last piano key on the exit. I am currently using AHK to extract (render) from these recordings each song that was sung, each sermon that was preached, and each miscellaneous moment given during the service (baptism, guest speaker, missionary speech, etc.). I have had some limited success using AHK, but with some painful drawbacks. Because there are several other functions that take place before and after each recording, I can't totally rely on using Reaper's scripts to do everything, but I am hoping it will become more dependable with the things I'm struggling with currently.

Current Minimum Needs:
From this forum today I am looking for a "possible/impossible" answer on the following list of functionality that my AHK script is currently attempting to perform (it does, but... it has some quirks that I usually have to fix after the fact, and it isn't exactly user-friendly or dependable):
1) Start Reaper at a specific time (Windows Scheduler can do this, but can Reaper?)
2) Load a template, save the project as a specified name/location
3) Pop-up a dialogue box prompting for:
` A) Song Special 'Title' for up to four songs
` B) Song Special 'Singers' for up to four songs
` C) Song Special 'Tracks used for recording' for up to four songs
` D) Sermon 'Series Title'* for up to two sermons
` E) Sermon 'Series Message Number'* for up to two sermons
` F) Sermon 'Sermon Title' for up to two sermons
` G) Sermon 'Preacher Name' for up to two sermons
` H) Sermon 'Opening Bible Verses' for up to two sermons
` I) Sermon 'Tracks used for recording' for up to two sermons
4) Start recording all 32 tracks at 2 minutes before Go-Time
5) Use the dialog box in step 3 above as follows for up to four song specials:
` A) When 'Start Song 1' is clicked, it will insert a marker using the following 'types' in the description field:
"Special 1 - Song Title - Singer Names - Tracks"
` B) When 'End Song 1' is clicked, it will insert a marker that simply states "End Special 1"
6) Use the dialog box in step 3 above as follows for up to two sermons:
` A) When 'Start Sermon 1' is clicked, it will insert a marker based on the logic between one of two possible types:
* i) IF Series Title is populated, Series Message Number must be present, and the following will be inserted into the marker's description: "Series Title - Message Number - Sermon Title - Preacher's Name - Verses Used - Tracks Recorded On"
` ii) IF Series Title is NOT used, then insert a marker with the following setup as the marker's description: "Sermon Title - Preacher's Name - Verses Used - Tracks Used"

7) When the recording is finished, use a button in the above dialog box to move on to the next step in the process by Reaper:
` A) Stop the recording
` B) Save the project
` C) For each of the above Types of markers (Song Special and Sermon so far), do the following
` i) Open a second project tab
` ii) Load a template tailored for website / email renderings to the singer's name / preacher's name
` iii) Switch back to the recorded Project Tab
` iv) Copy only the tracks from the Start Marker to the End Marker that was used during the recording (the last entry per marker line)
` v) Paste those tracks at the specified point and track (after the pre-recorded radio intro for sermons stored in that template; after the 10 second piano intro stored in those template for the website/email renderings; and the song specials will be copied to specific tracks based on their template settings)
` vi) Render those tracks to MP3 using a sub-name to the primary project name
` vii) Test the size of that rendering to see if it is small enough to email (20MB) - if not, reduce the quality and re-render until it is small enough
` viii) Paste the sub-name of that rendering as a new marker entry in the main Project Tab
` ix) Close that project tab and load the next one
` x) Cycle the above for all of the songs and sermons
8) Signal to the AHK Script to start extrapolating the markers for record keeping in the database
9) Close Reaper, and signal to the AHK Script to email the renderings to their appropriate destinations and perform any other duties assigned to the AHK Script (archiving, etc)


So.... CAN Reaper do all of that? Even if it can't is there a limitation to any of the above that might need to be worked out using an AHK Script?

I've been working on getting this set up for over a year, and what at first appeared to be a light at the end of the tunnel... is actually turning out to be a small group of tiny mice having a witty-bitty bonfire and not going anywhere soon. The tracks keep on going from here. Do I turn back and give up, or do I jump tracks and trudge on?

Signed,
A very frustrated tXShooter

Last edited by tXShooter; 10-21-2018 at 03:25 PM. Reason: Formatting
tXShooter is offline   Reply With Quote
Old 10-21-2018, 04:04 PM   #2
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Yes for most of them. No to 1, the rendering and re-rendering might be tricky, and I'm not sure about the last two - they might depend on what AHK is able to do.

I'd suggest Lua, as a) it's a fairly easy language to learn and b) you'd be able to take advantage of my GUI library for it to easily handle the dialog boxes and buttons.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 10-21-2018, 04:45 PM   #3
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by Lokasenna View Post
Yes for most of them. No to 1, the rendering and re-rendering might be tricky, and I'm not sure about the last two - they might depend on what AHK is able to do.

I'd suggest Lua, as a) it's a fairly easy language to learn and b) you'd be able to take advantage of my GUI library for it to easily handle the dialog boxes and buttons.
The starting up isn't an issue as that's what Window's Scheduler is doing by starting my AHK script, which then launches the Template (by filename), which in turn starts up Reaper. I then use some pre-setup configurations to determine the name to use for the project, then Save-As that project name, and start the recording. That part isn't an issue and can stay in AHK.

I've been trying to stick to just Action ID's, but there are some steps that require a different key-combination (click 'OK' or send {Escape} to start or cancel an operation). Some of these steps are to gather information only, which is used elsewhere in the script... I'm hoping I can circumvent a lot of this by some simple API calls in Reaper.

The Dialog Box is kind of tricky because in my current setup, after a person clicks on 'Start Song #', it changes that button into an Updater, whereby if you need to change something due to a typo or whatever, it will go to that marker and open up the Edit Marker function... this has been tricky to do in AHK, and not reliably so. I would like to find a way to keep this feature and make it work, but if it really can't, then I will move on and deal with it as is. However, the dialog box setup is something I strongly need, mostly because I need this to work for those that don't know how to operate Reaper when I'm not available... it needs to be idiot-proof as much as possible.

I have made a few attempts at trying to figure out Lua, but I gotta admit, there's not much that I've found that even explains how to start, let alone what each function does. My biggest stumbling block is that I can't find a good source of documentation to refer to... just a few videos. I did find one website that I think is a regular on this forum, but their English isn't easy to follow, and I get tripped up.

Where do I even start when it comes to writing Lua scripts? ReaScript directly, or is there another way to write and test (i.e. Notepad++)?
tXShooter is offline   Reply With Quote
Old 10-21-2018, 05:24 PM   #4
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by tXShooter View Post
However, the dialog box setup is something I strongly need, mostly because I need this to work for those that don't know how to operate Reaper when I'm not available... it needs to be idiot-proof as much as possible.
I feel like my GUI is going to make you really happy once you get that far.

Quote:
I have made a few attempts at trying to figure out Lua, but I gotta admit, there's not much that I've found that even explains how to start, let alone what each function does. My biggest stumbling block is that I can't find a good source of documentation to refer to... just a few videos. I did find one website that I think is a regular on this forum, but their English isn't easy to follow, and I get tripped up.
For the language itself, there are a ton of great Lua tutorials and resources out there:

- The official guide: https://www.lua.org/pil/1.html

- If you have an hour to spare: https://www.youtube.com/watch?v=iMacxZQMPXs

- There's a bunch of great stuff here: http://lua-users.org/wiki/LuaDirectory

- Googling any questions or errors you're puzzling over will often come up with more than a few very informative discussions on StackOverflow or StackExchange.

NOTE: If you're trying tutorials/examples that aren't specifically meant for Reaper, be aware that Reaper's Lua implementation doesn't have a print command - you can use reaper.ShowConsoleMsg in its place.

For the Reaper API:

- The actual documentation can be generated by Reaper via the Help menu. However, the formatting isn't very friendly so most of us keep a bookmark for X-Raym's version handy - it offers searching, filtering by language, and automatic copying for the function calls.

- X-Raym's videos are a great start.

- Here's a couple of tutorials I wrote, with the intention of developing a larger series. Real life is currently interfering with that, unfortunately, but they should get you started with the Reascript editor.

- Robert Randolph put up a great introduction to Lua and my GUI over on his site a couple of weeks ago.

Quote:
Where do I even start when it comes to writing Lua scripts? ReaScript directly, or is there another way to write and test (i.e. Notepad++)?
The built-in editor is nice for learning, and for working with smaller scripts, but after a while you'll probably benefit from the features a proper code editor can provide. There are Reaper API plugins for:

Notepad++ - https://stash.reaper.fm/v/23811/note...iptMonokai.zip
Atom - https://forum.cockos.com/showthread.php?t=173434
Sublime - https://forum.cockos.com/showthread.php?t=141221
VS Code - https://forum.cockos.com/showthread.php?t=208769

I used NP++ for a couple of years and, while it works, IMO it's just too complicated to set up things like languages and custom syntax highlighting, and the extensions are really hit or miss. The other three are all great and have a ton of great extensions, though I found VS Code way easier to get up and running with.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 10-21-2018, 05:55 PM   #5
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default Can Reaper OSC?

One more thing that I forgot to mention and inquire about before... something that I have been desperately trying to figure out... Can Reaper be programmed to REACT on actions taken by the Behringer X32 console via OSC?

I know that Reaper can directly interface to and control the X32, but more specifically, can it react when specific Scenes are loaded and switched away from?

If I can make that happen, then I won't need anyone to actually operate the Dialog Box unless there's something weird happening in real life (like an unscheduled song being sung or a surprise guest appearance (hey, it's happened many times at my church, catching all of us in the sound-booth off-guard)).
tXShooter is offline   Reply With Quote
Old 10-22-2018, 01:17 PM   #6
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default Navigating the controls?

I built a GUI (currently without any code to run yet), and it loads in the docker like I want. However, how do I Tab from one control to the next? Do I have to have some code that reacts to the Tab button?
tXShooter is offline   Reply With Quote
Old 10-22-2018, 07:59 PM   #7
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

There's some very, *very* rough tabbing code in there, but it only works with elements that make use of the .focus property - at the moment, only Textbox and TextEditor. If you're curious, or want to tinker, just assign the .tab_idx = [a number] property to a few text boxes and click into one. You should be able to Tab and Shift+Tab between them.

Disclaimer: I've only used the tab behavior in one script, so it may well be broken.

None of the other elements pay attention to keyboard input, so if you wanted a useful amount of tabbing you'd need to add that to them as well as some visual indicators (highlights, etc) to indicate where the focus is. They do gain .focus, it just doesn't affect anything. The onfocus method would be your friend there.

I'm happy to help in that endeavour, but I just started at a coding bootcamp so my spare time is pretty scarce.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 10-22-2018, 10:08 PM   #8
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by Lokasenna View Post
If you're curious, or want to tinker, just assign the .tab_idx = [a number] property to a few text boxes and click into one.

They do gain .focus, it just doesn't affect anything. The onfocus method would be your friend there.
(Insert happy yet utterly confused look here)

Yeah.... uh.... Whaaa? Put the dohicky thingamajig where?

When you say to assign the .tab_idx = [a number] property to a few text boxes, are you talking about in the GUI.new("Name","Textbox") { thingy, or what?

GUI.New("SongTitle4", "Textbox", { -- Song Textbox: SongTitle4
z = 11,
x = 200,
y = 120,
w = 250,
h = 25,
caption = "",
cap_pos = "left",
font_a = 3,
font_b = "monospace",
color = "txt",
bg = "wnd_bg",
shadow = true,
pad = 4,
undo_limit = 20
.tab_idx = 1 <-- Here?
})


I'm trying. I really am trying. I've been all over the web and back today to find something that put into context what you wrote, but I think my brain short-circuited when I was studying "Lokasenna's GUI library for Lua". I got some of it, but I'm very new to Lua and haven't seen enough code to give me an idea of the structure and layout that Reaper is looking for to make things work.

I attached the file that I've been working on. I created it in Notepad++ based loosely on your GUI creator (I got tired of accidentally crashing it by inadvertently double-clicking, so I opened what I had in NP++ and went from there). I haven't added any code to it yet because, well... I'm lost on where and what code needs to be added. I'll keep pecking away at that part though until I get it or need help.

I very much do appreciate the time you've taken to get me this far. Thank you.

Last edited by tXShooter; 12-25-2018 at 06:39 PM.
tXShooter is offline   Reply With Quote
Old 10-23-2018, 05:28 AM   #9
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

You had the right idea - just another property when you create them. In that case, though, you don't need the dot - just tab_idx = 3.

You'd use the dot notation if the element had already been created and you were accessing/creating a tab index: GUI.elms.my_textbox.tab_idx = 3.

As far as figuring out how to get things working, I recommend looking at the example scripts included in the Lokasenna GUI Developer Tools package. You should be able to find them with Script: Open Lokasenna_GUI v2 Developer Tools folder.lua.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 10-23-2018, 06:44 AM   #10
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by Lokasenna View Post
You had the right idea - just another property when you create them. In that case, though, you don't need the dot - just tab_idx = 3.
Removing the dot resulted in an error that I'm not understanding.

Here's a truncated section of the code
Quote:
shadow = true,
pad = 4,
undo_limit = 20
tab_idx = 3
})
Here's the error:
Quote:
Reaper DAW Interface GUI.lua:84: '}' expected (to close '{' at line 69) near 'tab_idx'
Quote:
Originally Posted by Lokasenna View Post
As far as figuring out how to get things working, I recommend looking at the example scripts included in the Lokasenna GUI Developer Tools package. You should be able to find them with Script: Open Lokasenna_GUI v2 Developer Tools folder.lua.
I'm reading through all of that now, and will be looking more closely at it today as time permits... there's a LOT of information to sift through in those 8 'pages' of posts/comments.

Again, thank you very much for your time and efforts. You seem to be like a super-human with all of your posts, code, and other contributions. I can't imagine what it must be like for your neurons and synaptic pathways.
tXShooter is offline   Reply With Quote
Old 10-23-2018, 07:13 AM   #11
karbomusic
Human being with feelings
 
karbomusic's Avatar
 
Join Date: May 2009
Posts: 29,269
Default

Quote:
shadow = true,
pad = 4,
undo_limit = 20
tab_idx = 3
})
Shouldn't there be a comma after undo_limit = 20? Since there isn't one, I think the compiler is assuming the closing brace (curly bracket) should go there; hence the wording of the error.
__________________
Music is what feelings sound like.
karbomusic is offline   Reply With Quote
Old 10-23-2018, 07:33 AM   #12
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by karbomusic View Post
Shouldn't there be a comma after undo_limit = 20? Since there isn't one, I think the compiler is assuming the closing brace (curly bracket) should go there; hence the wording of the error.
Indeed that was the issue. Thank you very much!!
tXShooter is offline   Reply With Quote
Old 10-23-2018, 07:52 AM   #13
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

There is some useful stuff in the thread, but I actually meant the tutorial scripts that were installed alongside the GUI Builder. They should be in /Reaper/Scripts/ReaTeam Scripts/Development/Lokasenna_GUI v2/Developer Tools/Examples and Templates - there are few different ways covered that you can have your code interact with the GUI and Reaper.

Also have a look at the documentation - it's in an HTML file in the Developer Tools folder, or in a much more readable form at: https://github.com/jalovatt/Lokasenna_GUI/wiki
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 10-24-2018, 06:48 AM   #14
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default How do I get my button to work?

Ok, still working some things out, but at this point I thought maybe I might need to get some direction on how the flow of Lua works as far as moving data and performing functions go.

I've built my GUI the way that I want it set up, adding labels, textboxes, and buttons. I've assigned the function "SetStart1" to the button "Start Special 1", and I've built the function as:

Code:
function SetStart1()
	txtbox_val = "Special 1 - " .. GUI.elms.SongTitle1.retval .. " - " .. GUI.elms.SongSinger1.retval .. " - " .. GUI.elms.SongTracks1
	Add_Marker(txtbox_val)
end

local function Add_Marker(myStr)

	local CursorPosition = reaper.GetCursorPosition()
	
	reaper.AddProjectMarker(0, false, CursorPosition, 0, myStr, -1)
	
end
function SetStart1() is supposed to get the values of the three textboxes (SongTitle1, SongSinger1, and SongTracks1), add them into a string of a specific format ("Special # - SongTitle# - SongSinger# - SongTracks#"), and then insert a marker at that button-clicking moment (hey, watch the language... ladies might be present) with this string as its name.

Button "End Special 1" is supposed to simply add a marker with its name set to "End Special #"... when I get that function built (one baby step at a time).


However, nothing happens when I click on "Start Song 1" button. No errors, markers, or even reaper.ShowConsoleMsg("A Button was Pressed") when I had that in the function of SetStart1().

What am I missing?


NOTE (and background - gibberish and ramblings of why I'm here in the first place): The goal of this is to pre-populate what I want my markers to be, and then insert them at their appropriate place during a live recording. I have an AHK script (currently... which might change depending on what Lua can do for me) that extrapolates (post-recording) each chunk of tracks (hence the SongTracks textboxes) based on their start and stop markers, and renders them as independent mp3's depending on who's on the mics at that time. This AHK script depends on how each marker's name is set, using a format of " - " (space hyphen space) to separate each piece of information, which also gets stored in an Excel database for later use. This last part might get changed if Lua can write directly to that database.

(I'm kinda thinking that some of the above GUI script might be useful to others using Reaper in a live performance scenario... maybe not exactly the way I have it currently designed, but some of it, perhaps.)

Btw, can Lua work directly with COM objects (Excel, Outlook, PowerPoint, MS Word, etc.)? I'm hoping to have the ability to pre-pre-populate the above textboxes from a different Excel spreadsheet in the future so that all is left to do is to actually click the buttons to insert their markers.

If I'm being honest, I hoping to automate the clicking of THOSE buttons by an OSC input from the Behringer X32 mixer. We use Scenes for each song special and sermon, and when the sound engineer switches to a specific scene, I'm hoping that action can be set up to automate the clicking of its assigned "Start Special 1" button; and click on "End Special 1" when it leaves that scene, and so on. There's a bigger picture to all of this besides the actual recording that I need to work with, and I'm just one guy wearing many hats in the overall scenario for each recording session. Scripts are awesome!

Last edited by tXShooter; 12-25-2018 at 06:39 PM.
tXShooter is offline   Reply With Quote
Old 10-24-2018, 08:01 AM   #15
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

- Lua doesn't perform any hoisting, so SetStart1 has to be declared prior to creating the button. Alternatively, you could leave it where it is, remove the func property from the button, and add GUI.elms.Song1StartButton.func = SetStart1 right after the function declaration.

- There's no native support for working with COM, but I'm seeing a few libraries that might help you out. One important thing to note: Reaper can only use libraries that are pure Lua - if there are .dlls involved, etc, you're out of luck.

- Alternatively, some programs like Excel can work with data as CSV text files. If that was an option, it's fairly easy to parse those in Lua.

- The script above won't run for anyone but you, as you don't set the color "fbc" anywhere. If you edited Core.lua directly... well, don't. Nobody else will have that color, and the file will be overwritten the next time there's a GUI update. You can set the color in your script though, anywhere after the GUI is loaded: [i]GUI.color["fbc"] = ....
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 10-24-2018, 09:51 PM   #16
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by Lokasenna View Post
- Lua doesn't perform any hoisting, so SetStart1 has to be declared prior to creating the button. Alternatively, you could leave it where it is, remove the func property from the button, and add GUI.elms.Song1StartButton.func = SetStart1 right after the function declaration.
It's late, and I must be misreading this because I'm getting only errors with everything that I'm trying.


Quote:
Originally Posted by Lokasenna View Post
- The script above won't run for anyone but you, as you don't set the color "fbc" anywhere. If you edited Core.lua directly... well, don't. Nobody else will have that color, and the file will be overwritten the next time there's a GUI update. You can set the color in your script though, anywhere after the GUI is loaded: [i]GUI.color["fbc"] = ....
Roger that... reverting Core.lua back to its original state. Thank you for that bit o'information. However, I'm lost on "[i]GUI.color["fbc"] = 204, 255, 0, 200" and where to place it. I'll have to study up on that one some other time. I need to stay focused on getting the buttons to do their jobs first before making pretty-pretties with them.
tXShooter is offline   Reply With Quote
Old 10-25-2018, 05:59 AM   #17
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

- Take the entire SetStart1 function and move it up before all of the elements are created, so it exists at the time you assign it to the button. As is you're giving the button the name of a function that hasn't been written so it just shrugs its shoulders at you.

- For colors and fonts, anytime after you've loaded [i]Core.lua[i] (all of the loadfile and require stuff) you can use GUI.colors["red"] = {16, 103, 192, 255}. If you want to add/change colors after GUI.Init has been run, it's the same thing but you have to use values from 0-1 rather than 0-255.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 10-25-2018, 06:04 PM   #18
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by Lokasenna View Post
- Take the entire SetStart1 function and move it up before all of the elements are created, so it exists at the time you assign it to the button. As is you're giving the button the name of a function that hasn't been written so it just shrugs its shoulders at you.

- For colors and fonts, anytime after you've loaded [i]Core.lua[i] (all of the loadfile and require stuff) you can use GUI.colors["red"] = {16, 103, 192, 255}. If you want to add/change colors after GUI.Init has been run, it's the same thing but you have to use values from 0-1 rather than 0-255.
Thank you for that valuable information. I've used it and have gotten past this point.

I have some other questions now, which may or may not be related to the GUI.
1) I noticed when the alpha for the buttons is not 255, the corners do not color the same as the body. Is that by design, or have I made an error with my definition: GUI.colors["invalid"] = {255, 255, 0, 240}?

2) I'm wanting to change the color of the button based on the validation of a textbox entry (or a sum of textbox entries). For example, textboxA or textboxB or textboxC must contain something before button1 is enabled and turns yellow, but when all of those textboxes have a valid entry (using an AND instead of OR) the same button will turn Green and enable the posting of a marker when clicked. Each change will cause the caption of the same button to change... from "Set Marker 1" in dark, barely contrasting colors for text and button, to "Set Marker 1" in gray on yellow, to "Update Marker 1" in black on green. At the same time, if a textbox entry is deleted, I want to reverse the states of the button to reflect that it's not ready to create a marker. My function calling foo is weak in this area without creating errors, so how do I call a function to change the color and use global variables to set its state? I might be able to get through this one on my own, but with the advent of what appears to be fairly new GUI abilities in Lua, I thought it best to ask now before I get myself into some deep kimshee.

3) How do I create a GUI whose default home is in the Docker? (Is there any way to lock it into the docker?) I've tried using Command ID 41172 in local function Main(), but it would seem that isn't the correct location for such code, or quite possibly not the right code to use in the first place??

reaper.Main_OnCommand(41172) -- Dock/undock currently focused window


4) I've tried a few different ways to set markers, but the API info page is rather lacking on information, details, and examples, and the ending results weren't exactly as I had hoped. I am able to create markers, but what I'm trying to do is limit how many markers are created to just the number of buttons in the GUI. I seem to either be re-writing the incorrect marker, or adding a new one with a number out of sequence. I am hoping to get my script so that if someone needs to relocate a marker due to a delay in the live performance (the person at the microphone gets long-winded and decides to talk about irrelevant topics before getting to their task), the operator can click an [b]Update Time[b] button (I still need to create this button) to relocate the last marker to the 'real' starting point. Likewise, if the operator mistypes something, they can click the same button that they used to create the marker, but that same button's caption be changed to "Update Marker 1", and it will just simply update the text of that marker without changing position. Are either of these two button / marker actions feasible? If so, I will need to change up my GUI layout some, but if not, I will need to figure out how to get what I currently have working correctly and move on.
Currently my code for button1 is:
Code:
function SetSongStart1()
	local MarkerNum = 1
	local Song = GUI.elms.SongTitle1.retval
	local Singer = GUI.elms.SongSinger1.retval
	local Track = GUI.elms.SongTracks1.retval
	local Marker = "Special 1 - " .. Song .. " - " .. Singer .. " - " .. Track
-- reaper.SetProjectMarkerByIndex(ReaProject proj, integer markrgnidx, boolean isrgn, number pos, number rgnend, integer IDnumber, string name, integer color)
-- reaper.AddProjectMarker(ReaProject proj, boolean isrgn, number pos, number rgnend, string name, integer wantidx)
-- reaper.AddProjectMarker2(ReaProject proj, boolean isrgn, number pos, number rgnend, string name, integer wantidx, integer color)
	-- Works: reaper.Main_OnCommand(40434,0)
	reaper.AddProjectMarker(0,0, reaper.GetPlayPosition(),0,Marker,-1)
	-- reaper.SetProjectMarkerByIndex(0,0, false, CursorPosition, 0, MarkerNum, Marker, 4)
	-- reaper.ShowMessageBox("Marker Number: " .. MarkerNum .. "\n\nMarker Description:\n" .. Marker,"Reaper DAW Interface",0)
end
5) I think that I will stop here for now... I'm needing to work toward the post-recording production and rendering using templates in a second project tab, but I think that I have my hands full with these 4 items.

Lokasenna, I can not tell you how much I appreciate your input and help as I get started in Lua. Thank you so very much.
tXShooter is offline   Reply With Quote
Old 10-25-2018, 09:03 PM   #19
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default Docking a GUI

Wow, that was simpler than I thought it would be:

Code:
GUI.dock = 1
tXShooter is offline   Reply With Quote
Old 10-26-2018, 06:16 AM   #20
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

1. It's by design, unfortunately. In order to avoid ugly jagged edges when all of the z layers are composited together, I have to draw a rectangle of the background color behind each element.

2. You can use the textbox class' lostfocus to run a function whenever one of them is clicked out of, or the user presses Enter.

Code:
local function check_textbox_status()
 ...return true if we're good...
end

local function update_button_state()
  if check_textbox_status() then
    ...do stuff...
  else
    ...do other stuff...
  end
end

function GUI.elms.my_textbox1:lostfocus()
  update_button_state()

  -- The textbox's original lostfocus does this,
  -- so we have to include it in our overwritten version
  self.redraw()
end
function GUI.elms.my_textbox2:lostfocus()
  ..
end
function GUI.elms.my_textbox3:lostfocus()
  ..
end
I have a bus to catch, will try to address the other points later.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 10-26-2018, 06:36 AM   #21
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by Lokasenna View Post
1. It's by design, unfortunately. In order to avoid ugly jagged edges when all of the z layers are composited together, I have to draw a rectangle of the background color behind each element.
Roger that. Thank you for letting me know.


Quote:
Originally Posted by Lokasenna View Post
2. You can use the textbox class' lostfocus to run a function whenever one of them is clicked out of, or the user presses Enter.
I knew it had to do something with losing focus, but couldn't discern how or where to place that kind of code. Thank you for clearing that part up. However, I am receiving an error in Core.lua:
Error: Core.lua:1164: attempt to index a nil value (local 'self')

Code:
function ValidateButton1()
	reaper.ShowMessageBox("Validating for Button 1", "Reaper DAW Interface",0)
end
GUI.New("SongTitle1", "Textbox", { 			-- Song Textbox: SongTitle1
    z = 11,
    x = 200,
    y = 42,
    w = 250,
    h = 25,
    caption = "",
    cap_pos = "left",
    font_a = 3,
    font_b = "monospace",
    color = "txt",
    bg = "wnd_bg",
    shadow = true,
    pad = 4,
    undo_limit = 20,
	tab_idx = 1
})
function GUI.elms.SongTitle1:lostfocus()
	ValidateButton1()
	self.redraw()
end
The messagebox does show up, but, then it's followed by that error after clicking 'OK' in the messagebox.

What's the difference between local function ... and function ...?

I'm assuming that if I were to truly 'grey out' a button, I would have to interrupt or rewrite the action for onmousedown when one tries to click on that button. Does that sound about right?
tXShooter is offline   Reply With Quote
Old 10-26-2018, 08:03 AM   #22
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

My mistake, that should be self:redraw().

Not sure if you're familiar with object-oriented programming concepts at all, but the : syntax is a shorthand for referring to the object or element that a function is attached to, similar to this in a language like Javascript. This:
Code:
function my_object:print_width()
  print(self.width)
end

my_object.width = 4

my_object:print_width()
is functionally the same as this:
Code:
function my_object.print_width(self)
  print(self.width)
end

my_object.width = 4

my_object.print(my_object)
Some reading material if you're interested in going further down that rabbit hole: http://forum.cockos.com/showpost.php...6&postcount=45

----

Quote:
What's the difference between local function ... and function ...?
By default, all variables/functions/tables/etc in Lua are "globally scoped", meaning that they're visible and accessible from anywhere in the script. This might seem like a good idea, but there are two potential drawbacks:

- If you use the same variable name in multiple functions, they'll all be working with the same variable. What one function does might change the value a different function left there, causing things to break, etc.

- Specific to Lua, global variables are stored differently in memory and there's a slight performance hit when accessing them. Most of the time it's nothing you'd notice, but in something like a GUI or audio processing script all of those CPU cycles can start to add up.

Adding local in front of things limits their scope (visibility and lifetime) to the function, if-then block, for-loop, etc that they're in. Using local variables is considered a good practice in pretty much any programming situation unless you specifically want something to be available everywhere (all of the GUI functions are global, for instance).

----

Quote:
I'm assuming that if I were to truly 'grey out' a button, I would have to interrupt or rewrite the action for onmousedown when one tries to click on that button. Does that sound about right?
Correct, although you'd have to rewrite both onmousedown to stop the "pressed" animation, and [i[]onmouseup[/i] to stop the button's function from being run.

I've found it easier to put a Frame element in front of (lower z) the button with its color set to something like "shadow" or "faded". Frames don't do anything with user input, so clicking on it will just block that event from going to the button.

This is done by having the frame start out on a separate, hidden z-layer, then moving it in front of the button or back again as needed. See Example - Adding a Main loop, working with Z layers, and Rewriting Methods.lua in the Developer Tools folder for an example.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 10-26-2018, 01:51 PM   #23
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default How do I change the color of a control?

OOP is something that I haven't had much of a chance to dabble in, but I understand the concept some. My programming days stem from the age of DOS 3.3, Assembly language, and general BASIC, which was just as C/C++ was really hitting the markets. I've messed around with VBA, Visual Basic, and AHK, but alas, not much in Object Oriented Programming directly.

Pressing on...

OK, I'm making some progress, but still have quite the road to travel for completion, and I'm trying to get a baseline-alpha version working by this Sunday. My current hurdle is still changing the color of the button after validating the textbox entry (something to indicate to the operator that they can move forward with the placement of the marker vs. there being an error to correct before doing so).

Below is what I have so far. I'm pretty sure it keeps crashing because I'm not implementing the color change correctly. What do I need to be doing here? (I have searched all over to find some kind of documentation on Lua GUI that would tell me how to do this, but it would appear that your design is somewhat of a pioneer in this field, and I certainly don't have the knowledge necessary to re-invent this wheel, especially to this level of elegance and finesse.)

Code:
-- ***************** GLOBAL VARIABLES ***************** -- 
GUI.dock = 1 -- TODO: Find out how to force a single instance only.
Song1Valid = false
GUI.colors["disabled"] = {0, 0, 0, 51} 		-- TODO: Finalize colors after making 
GUI.colors["enabled"] = {240, 240, 10, 248} --       sure the script works
GUI.colors["invalid"] = {255, 255, 0, 240}
-- GUI.colors["valid"] = {0, 255, 0, 240}

-- *************** END GLOBAL VARIABLES *************** --

-- *************** Define the Functions *************** --
function ChangeButtonColor(iButton, cColor) -- TODO: Add whatever paramaters it takes to get this to function correctly after consulting with The Forum.
	GUI.elms.Song1StartButton.col_fill = cColor
	self:redraw("Song1StartButton")
	-- reaper.ShowMessageBox("Changing button " .. iButton .. " to " .. cColor,"Reaper DAW Interface",0)
end

local function ValidateButton1() -- TODO: Is there a better way for all 12 buttons (perhaps with a class setup)?
	local Song = GUI.elms.SongTitle1.retval -- TODO: Is there a better way for validating all 6 blocks of textboxes (perhaps with a class setup)?
	local Singer = GUI.elms.SongSinger1.retval
	local Track = GUI.elms.SongTracks1.retval

	if Song ~= "" and Singer ~= "" and Track ~= "" then
		ChangeButtonColor(1,"enabled") -- May need a 3rd parameter
		Song1Valid = true
	elseif Song == "" and Singer == "" and Track == "" then
		ChangeButtonColor(1,"disabled")
		Song1Valid = false
	elseif Song ~= "" or Singer ~= "" or Track ~= "" then
		ChangeButtonColor(1,"invalid")
		Song1Valid = false
	end	
	-- reaper.ShowMessageBox("Validating Button 1", "Reaper DAW Interface",0)
end

function SetSongStart1()
	local MarkerNum = 1
	if Song1Valid == true then
		local Song = GUI.elms.SongTitle1.retval
		local Singer = GUI.elms.SongSinger1.retval
		local Track = GUI.elms.SongTracks1.retval
		local Marker = "Special 1 - " .. Song .. " - " .. Singer .. " - " .. Track
	else
		return
	end
-- reaper.SetProjectMarkerByIndex(ReaProject proj, integer markrgnidx, boolean isrgn, number pos, number rgnend, integer IDnumber, string name, integer color)
-- reaper.AddProjectMarker(ReaProject proj, boolean isrgn, number pos, number rgnend, string name, integer wantidx)
-- reaper.AddProjectMarker2(ReaProject proj, boolean isrgn, number pos, number rgnend, string name, integer wantidx, integer color)
	-- Works: reaper.Main_OnCommand(40434,0)
	reaper.AddProjectMarker(0,0, reaper.GetPlayPosition(),0,Marker,-1)
	-- reaper.SetProjectMarkerByIndex(0,0, false, CursorPosition, 0, MarkerNum, Marker, 4)
	-- reaper.ShowMessageBox("Marker Number: " .. MarkerNum .. "\n\nMarker Description:\n" .. Marker,"Reaper DAW Interface",0)
	ChangeButtonColor(MarkerNum, Marker)
end
-- *********** End of Function Definitions ************

-- ********** Create the GUI **************
GUI.New("Song1StartButton", "Button", { 	-- Song Button: Song1StartButton
    z = 11,
    x = 875,
    y = 43,
    w = 95,
    h = 20,
    caption = "Start Special 1",
    font = 3,
    col_txt = "txt",
    col_fill = "maroon"
})
GUI.elms.Song1StartButton.func = SetSongStart1

-- ********* End of GUI Creation ************
I gather that the lower the number for Z, the more in-your-face that layer will be? I will work on the Z-order button blocker thingy after I get this code to work for Sunday (unless I miraculously finish this and find some time before then). Until then, I will just test a variable and not allow the placement of the marker until the proper conditions are met.
tXShooter is offline   Reply With Quote
Old 10-26-2018, 10:03 PM   #24
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default Rendering tricky... yeeeaaahhhhhh. You can say that again!

Quote:
Originally Posted by Lokasenna View Post
...the rendering and re-rendering might be tricky...
I've been all over the interwebs today trying to get around having to manually set the settings, filename, and path in the Render Dialog box, and I have found an ENORMOUS amount of people raising complaints that this can't be done via a script from within Reaper. It is extremely sad that the only two ways to do this (currently, I read that the next build might have a possible workaround for this) is to either rewrite the .RPP file and reload the project, or to use AHK (or some other similar externally manipulating script).

I can't even use PostMessage / SendMessage from within Reaper... I have to run that externally, with zero way of actually launching that from within Reaper. And I so very much wanted to switch from AHK to Reascript as that was one of the BIGGEST reasons I started looking at Reascript in the first place... AHK was just too sloppy to be relied upon.

I guess there must be some kind of legal arrangement concerning the copyrights to some of the Rendering Engines for whatever reason. That's about the only thing that would make sense as to why the developers have not implemented this feature.

If anyone knows of a real way to get around this, please, by all means, post and share. Maybe I overlooked something in this short amount of time studying this. I certainly hope so.
tXShooter is offline   Reply With Quote
Old 11-14-2018, 08:46 PM   #25
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default How do you use 'GUI.Val' ?

I think I'm getting 'nil' errors on the first MsgBox and nothing happening on the 2nd MsgBox because I'm doing something wrong, but I can't seem to find enough documentation / examples on GUI.Val to figure it out on my own.

Checklists are indexed at 1, right?

Code:
GUI.req("Classes/Class - Options.lua")()
GUI.colors["disabled"] = {0, 0, 0, 51}
GUI.colors["enabled"] = {240, 240, 10, 248}
GUI.colors["invalid"] = {255, 255, 0, 240}
function MsgBox(tMessage)
	reaper.ShowMessageBox(tMessage,"Window Title Goes Here",0)
end
GUI.New("Checklist1", "Checklist", {
    z = 11,
    x = 10,
    y = 100,
    w = 96,
    h = 32,
    caption = "",
    optarray = {"This Option"},
    dir = "v",
    pad = 4,
    font_a = 2,
    font_b = 3,
    col_txt = "txt",
    col_fill = "elm_fill",
    bg = "wnd_bg",
    frame = false,
    shadow = true,
    swap = nil,
    opt_size = 20
})

local function Main()
--...
	local cBox = GUI.Val("Checklist1")
	MsgBox(cBox)
	if cBox == 1 then MsgBox("This option selected") end
--...
end
GUI.Init()
GUI.func = Main
GUI.freq = 0
GUI.Main()
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 11-14-2018, 09:09 PM   #26
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

It returns an array of boolean values, so you need to check if f.e. GUI.Val("my_checkbox")[1] == true.

The error on the first one is because Lua doesn't like implicitly converting arrays (possibly an empty array if nothing is selected) to strings, and the lack of anything happening on the second is because you're comparing an array with a number.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 11-15-2018, 04:00 PM   #27
tXShooter
Human being with feelings
 
tXShooter's Avatar
 
Join Date: Aug 2017
Posts: 336
Default

Quote:
Originally Posted by Lokasenna View Post
It returns an array of boolean values, so you need to check if f.e. GUI.Val("my_checkbox")[1] == true.
Code:
	if GUI.Val("Checklist1")[1] == true then MsgBox("Option selected") end
	if GUI.Val("Checklist1")[1] == false then MsgBox("Option unselected") end
It's still returning Error: Reaper DAW Interface GUI.lua:1481: attempt to index a nil value

What am I doing wrong? Am I using to correct name (see code in previous post)?
__________________
"But be ye doers of the word, and not hearers only, deceiving your own selves."
tXShooter is offline   Reply With Quote
Old 11-21-2019, 11:26 AM   #28
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 813
Default

Quote:
Originally Posted by tXShooter View Post
Code:
	if GUI.Val("Checklist1")[1] == true then MsgBox("Option selected") end
	if GUI.Val("Checklist1")[1] == false then MsgBox("Option unselected") end
It's still returning Error: Reaper DAW Interface GUI.lua:1481: attempt to index a nil value

What am I doing wrong? Am I using to correct name (see code in previous post)?
Did you find a solution? I got the same error.
I think I found a solution for a long time ago, but have now forgotten
what the solution was. So if you have one Im happy to hear about it ;-)
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 11-21-2019, 01:34 PM   #29
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Sorry for not responding to the previous post; I was in school and never saw it.

attempt to index a nil value always means that you tried to dig too far into something without checking that each level exists - that is, if GUI.Val("Checklist1") doesn't return a table you can't possibly access it with a table index.

My guess would be that the Checklist only has one item in it, in which case the GUI returns the value itself rather than a table with one item. Probably a stupid decision on my part, but there you go.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 11-21-2019, 01:59 PM   #30
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 813
Default

Quote:
Originally Posted by Lokasenna View Post
Sorry for not responding to the previous post; I was in school and never saw it.

attempt to index a nil value always means that you tried to dig too far into something without checking that each level exists - that is, if GUI.Val("Checklist1") doesn't return a table you can't possibly access it with a table index.

My guess would be that the Checklist only has one item in it, in which case the GUI returns the value itself rather than a table with one item. Probably a stupid decision on my part, but there you go.
Hi Lokasenna!
You are right my Checklist only has one item in it - I use it like a
checkbox for a boolean. I have tried to assign the value of the checkbox
to a variable called autoContinue but I dont manage to get the coding
right. I have used

Code:
autoContinue = GUI.Val("Checklist1",[1])
and some variations with {} but I cant get it right.
What I want is to get the value of Checklist1 and save it
with SetProjExtState and later restore it with GetProjExtState.
I have managed to store and restore integers and strings, but
this Checklist1 is impossible! I sat about six hours today,
googled and tried different variations but no luck ;-(

Right now my head feels like a crusched tomatoe - have to
continue with this tomorrow after work, and get some sleep now....
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 11-21-2019, 02:40 PM   #31
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

With only one item it just returns the boolean value directly:

Code:
local autoContinue = GUI.Val("Checklist1")
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 11-22-2019, 06:53 AM   #32
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 813
Default

Quote:
Originally Posted by Lokasenna View Post
With only one item it just returns the boolean value directly:

Code:
local autoContinue = GUI.Val("Checklist1")
Ooooookey......its fantastic, I have been trying variations on code
but none of them was so easy ;-)

....so instead of sitting 6 more hours I ask you, is this the correct
way to set Checkbox to true?

Code:
GUI.Val("Checklist1", {1 = true})
Cant get it to work, is doing this:

Code:
  GUI.Val("Checklist1", {1 = autoContinue})
But gets '}' expected near '=', and if I put } before =
I got another error, and so on....
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 11-22-2019, 07:23 AM   #33
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Your table syntax is wrong. With numeric indices, you can either omit them and let it count for itself:
Code:
GUI.Val("Checklist1", {autoContinue})
or wrap the number in []s:
Code:
GUI.Val("Checklist1", {[1] = autoContinue})
The "if there's only one element, just return the boolean value" behaviour for Checklist also works both ways - if you only have one element, you can just throw the value in there:
Code:
GUI.Val("Checklist1", autoContinue)
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 11-22-2019, 08:40 AM   #34
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 813
Default

Quote:
Originally Posted by Lokasenna View Post
Your table syntax is wrong. With numeric indices, you can either omit them and let it count for itself:
Code:
GUI.Val("Checklist1", {autoContinue})
This worked!!

But not this - is it because Im on linux?

Code:
GUI.Val("Checklist1", autoContinue)
Or maybe because autoContinue is a boolean? Working that way with integers (and not Checklists)
works fine.
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify

Last edited by tompad; 11-22-2019 at 08:59 AM.
tompad is offline   Reply With Quote
Old 11-22-2019, 09:06 AM   #35
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Oh... it IS because it's a boolean, but not your fault. The internal code checks if newval... but if you specifically pass it false that will obviously fail.

I'm at work right now but can have a fix up later this evening.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 11-22-2019, 09:50 AM   #36
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 813
Default

Quote:
Originally Posted by Lokasenna View Post
Oh... it IS because it's a boolean, but not your fault. The internal code checks if newval... but if you specifically pass it false that will obviously fail.

I'm at work right now but can have a fix up later this evening.
No hurry! I got it working with the other solution you suggested, thanks.

Oh by the way, the example I had was from the documentation
(from ReaPack installed Lokasenna GUI), is there any other place
with more correct documentation?

Something completly different - I know you are working on a v3
of the GUI (VERY interesting!). Will this new version force us
to rebuild the scripts or will the old scripts (v2) run with v3?
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 11-22-2019, 10:10 AM   #37
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by tompad View Post
Oh by the way, the example I had was from the documentation (from ReaPack installed Lokasenna GUI), is there any other place with more correct documentation?
The HTML included with the Developer Tools package should be consistent with the project wiki ( https://github.com/jalovatt/Lokasenna_GUI/wiki ). I do see that the documentation for Checklist is missing that behaviour though, so I'll make sure to add that tonight as well.

Quote:
Something completly different - I know you are working on a v3 of the GUI (VERY interesting!). Will this new version force us to rebuild the scripts or will the old scripts (v2) run with v3
v2 scripts will not run on v3, as I've made some pretty significant changes to how everything is structured to make it all more efficient and easier to work with.

v2 will remain on ReaPack though, and I'll fix bugs when they come up, so existing scripts will be fine.

v3 is currently in the pre-release stage (i.e. I'm writing the documentation and a pretty webpage for it) so you're welcome to start working on scripts for it or migrating existing ones if you want - just don't release anything yet.

The repo is here. Documentation is currently in /docs, and all of the example scripts from v2 have been brought over in /development/examples. I haven't had a chance to update the comments in them though, so they may still refer to v2 stuff.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 11-23-2019, 04:20 AM   #38
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 813
Default

Quote:
Originally Posted by Lokasenna View Post
v2 will remain on ReaPack though, and I'll fix bugs when they come up, so existing scripts will be fine.
Excellent!

Quote:
v3 is currently in the pre-release stage (i.e. I'm writing the documentation and a pretty webpage for it) so you're welcome to start working on scripts for it or migrating existing ones if you want - just don't release anything yet.

The repo is here. Documentation is currently in /docs, and all of the example scripts from v2 have been brought over in /development/examples. I haven't had a chance to update the comments in them though, so they may still refer to v2 stuff.
Exciting! Looking forward to start use v3!
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify
tompad is offline   Reply With Quote
Old 11-23-2019, 06:38 AM   #39
tompad
Human being with feelings
 
Join Date: Jan 2010
Location: Fjugesta, Sweden
Posts: 813
Default

Cant delete this - realized I hijacked this thread.
Have made a new thread in forum.
__________________
ToDoList Obliques MusicMath Donation Some of mine and my friends music projects on Spotify

Last edited by tompad; 11-23-2019 at 06:45 AM.
tompad is offline   Reply With Quote
Old 11-23-2019, 08:27 AM   #40
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

I've uploaded a fix for the bug above.
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -7. The time now is 03:13 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.