Old 05-30-2021, 10:29 AM   #1
Lamerak
Human being with feelings
 
Join Date: Sep 2019
Posts: 3
Default Can't get Main.On_Command to work :/

What's even weirder is that in the script I'm currently writing, it's two 'Main.OnCommand's, the first one works, the second doesn't. Here's my current code.

__________________________________________________ ___________________

-- duplicate selected midi item
reaper.Main_OnCommand(41295, 0) --Edit: Duplicate Events

-- open MIDI Editor
reaper.Main_OnCommand(40716, 0) -- View: Toggle show MIDI editor windows

__________________________________________________ _______________________

Basically it is supposed to just duplicate the selected midi item on the timeline, then it's supposed to open the MIDI editor for that duplicated item.

I have never used Lua or ReaScript before, but i've used several other languages before, i'm basically just using this script to get started learning, so my apologies if there is some dumb mistake i'm making. I also included the script as an attachment.

I'm just pretty confused why the first one will work, but not the second.

Also, another question i had, is there a way to debug these scripts? The biggest issue i've been having working with lua/reascript is that there doesen't really seem to be a way to actually walk through your code and debug it, even the "OnCommand" function doesen't return a boolean if it performed it's action or not.

Any help would be much appreciated!
Attached Files
File Type: lua DuplicateandOpen.lua (183 Bytes, 43 views)

Last edited by Lamerak; 05-30-2021 at 10:41 AM.
Lamerak is offline   Reply With Quote
Old 05-30-2021, 12:08 PM   #2
ErBird
Human being with feelings
 
Join Date: Jan 2017
Location: Los Angeles
Posts: 1,161
Default

Hi. That action doesn't open a MIDI editor, but just toggles visibility (show).
I believe you're looking for
"Item: Open in built-in MIDI editor (set default behavior in preferences)"
ErBird is offline   Reply With Quote
Old 05-30-2021, 04:52 PM   #3
Lamerak
Human being with feelings
 
Join Date: Sep 2019
Posts: 3
Default

Quote:
Originally Posted by ErBird View Post
Hi. That action doesn't open a MIDI editor, but just toggles visibility (show).
I believe you're looking for
"Item: Open in built-in MIDI editor (set default behavior in preferences)"
Ah, i knew it would be something trivial like that! Thank you for the help!
Lamerak 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 01:39 PM.


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