Old 03-09-2017, 03:52 AM   #1
tionline
Human being with feelings
 
Join Date: Mar 2017
Posts: 2
Default Script to create markers ?

Hi everyone,

I'm pretty new to Reaper and I just discovered there was an impressive way to make scripts for different actions.
I found an easy way to assign a keyboard shortcut to create a marker (for example, Ctrl+8 to create a marker with ID 8). But the predifined actions only goes from marker 1 to marker 10. Do you think it could be possible to go up to 20 (with other keys like F1, F2...) with a script ?

I guess it could be done with a function like "SetProjectMarker" ou "SetProjectMarkerByIndex"... could somobedy help me a little ?
I tried editing X-Raym's scripts but I'm really lost !

Thanks and lot, and sorry for my english, I'm doing my best !
Marc
tionline is offline   Reply With Quote
Old 03-09-2017, 08:47 AM   #2
Claudiohbsantos
Human being with feelings
 
Join Date: Aug 2014
Location: New York
Posts: 135
Default

I believe this would work:

Code:
reaper.Undo_BeginBlock()
reaper.PreventUIRefresh(1)

	local id = INSERT_ID_YOU_WANT_HERE
	local pos = reaper.GetCursorPosition()
	reaper.AddProjectMarker2(0,false,pos,0,"", id,0)

reaper.PreventUIRefresh(-1)
reaper.Undo_EndBlock("Create Marker", -1)
If you want to have a specific name you should place it inside the quotation marks.
__________________
My Reapack Repo - Reapack Extension
Claudiohbsantos is offline   Reply With Quote
Old 03-09-2017, 01:53 PM   #3
tionline
Human being with feelings
 
Join Date: Mar 2017
Posts: 2
Default

Thanks a lot, Claudio !

It works well, and looks easier than I thought. But I still have a last question ;-)

With your script, multiple markers can share the same ID. So I tried to add a line to prevent this. It seems to be working on my computer but I'm not sure this is the best way to do so. Could you tell me what you think about this ?

Code:
reaper.Undo_BeginBlock()
reaper.PreventUIRefresh(1)

	local id = MARKER_ID
	local pos = reaper.GetCursorPosition()
	reaper.DeleteProjectMarker(0, id, false)
	reaper.AddProjectMarker2(0,false,pos,0,"", id,0)

reaper.PreventUIRefresh(-1)
reaper.Undo_EndBlock("Create Marker", -1)
Thanks again!
tionline 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 02:54 AM.


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