Old 07-09-2019, 12:14 AM   #1
zookthespook
Human being with feelings
 
Join Date: Mar 2015
Location: India Mumbai
Posts: 816
Default Autoexec scripts on startup ?

Hi
I am just curious whether it is possible to auto execute a few scripts right at the start of the software ?
Though i have made tabs for the Eugen's RR scripts but this would be one scenario where it could come in handy .


regards
zook
zookthespook is offline   Reply With Quote
Old 07-09-2019, 01:08 AM   #2
teniente powell
Human being with feelings
 
teniente powell's Avatar
 
Join Date: Oct 2016
Location: Spain
Posts: 323
Default

Run action "SWS/S&M: Set global startup action" for any project, or "SWS/S&M: Set project startup action" for one project.
teniente powell is offline   Reply With Quote
Old 07-09-2019, 03:01 AM   #3
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,239
Default

create a file "__startup.lua" in the "Scripts" folder.
This will be executed on start. Inside this script you can also call other scripts for example like this:
Code:
reaper.Main_OnCommand(reaper.NamedCommandLookup("_RSe3ad1140dc733c3ccfe65a67ec53bfc634535821"), -1) --Run Track Inspector VIP
heda is offline   Reply With Quote
Old 07-09-2019, 01:40 PM   #4
zookthespook
Human being with feelings
 
Join Date: Mar 2015
Location: India Mumbai
Posts: 816
Default

awesome yay !!

thanks a lot for helping out

regards
zook
zookthespook is offline   Reply With Quote
Old 07-11-2019, 12:28 PM   #5
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

@heda
What effect has setting the parameter flags to -1 in your code?
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 07-11-2019, 03:14 PM   #6
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,239
Default

Quote:
Originally Posted by mespotine View Post
@heda
What effect has setting the parameter flags to -1 in your code?
For more mystery... I could have used -23496 instead of -1
No idea... I can't remember why I put -1 instead of 0. I think that flag parameter is not used. It is not documented.
heda is offline   Reply With Quote
Old 07-16-2019, 11:51 AM   #7
zookthespook
Human being with feelings
 
Join Date: Mar 2015
Location: India Mumbai
Posts: 816
Default

Quote:
Originally Posted by heda View Post
For more mystery... I could have used -23496 instead of -1
No idea... I can't remember why I put -1 instead of 0. I think that flag parameter is not used. It is not documented.
hahaha
zookthespook is offline   Reply With Quote
Old 07-17-2019, 07:59 AM   #8
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Geez, I had hope....

and there's a crying smiley missing in this forumssoftware...
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 07-17-2019, 10:17 AM   #9
zookthespook
Human being with feelings
 
Join Date: Mar 2015
Location: India Mumbai
Posts: 816
Default

the global startup SWS command worked flawlessly.
Is there a way to add more than one startup command as well ?

zook
zookthespook is offline   Reply With Quote
Old 07-17-2019, 10:24 AM   #10
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Only with one script, in which you add all the ones you want to load and running this script by SWS.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 07-17-2019, 11:03 AM   #11
zookthespook
Human being with feelings
 
Join Date: Mar 2015
Location: India Mumbai
Posts: 816
Default

Oh ok will do
zookthespook is offline   Reply With Quote
Old 07-17-2019, 01:09 PM   #12
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,239
Default

I recommend the method of using the __startup.lua file instead of SWS. You can add as many actions in the lua file as needed. There is something with the SWS that sometimes wasn't working, at least running scripts, maybe for standard actions or custom actions is ok.
heda is offline   Reply With Quote
Old 07-17-2019, 01:21 PM   #13
zookthespook
Human being with feelings
 
Join Date: Mar 2015
Location: India Mumbai
Posts: 816
Default

ok i have no knowledge of coding at all but i tried this
made a new script _startup.lua

then added this code, copying your code line and added the scripts
Quote:
reaper.Main_OnCommand(reaper.NamedCommandLookup
("_RSe3ad1140dc733c3ccfe65a67ec53bfc634535821") , -1) --Run Track Inspector VIP
("_RS67fdf22be642a98b636a7c6eadf233e63b831d46") , -2) --Run Retrospective Record (MIDI)
("_RS6e7d8e039b636d070ecfcbf6bd71c3728658a741") , -3) --Run Retrospective Record (audio)
i tried to sneak in a "end" as well but the compiler caught my bluff ! hehe
it is showing error . it was highlighting the bracket in red near the -2 and -3
can you help me with this !

regards
zook

Last edited by zookthespook; 07-17-2019 at 01:26 PM.
zookthespook is offline   Reply With Quote
Old 07-17-2019, 01:40 PM   #14
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 7,239
Default

try this
also notice that the file has to have two _ underscore characters... not one. "__startup.lua"
I don't know why.



Code:
reaper.Main_OnCommand(reaper.NamedCommandLookup("_RSe3ad1140dc733c3ccfe65a67ec53bfc634535821"), 0) --Run Track Inspector VIP

reaper.Main_OnCommand(reaper.NamedCommandLookup("_RS67fdf22be642a98b636a7c6eadf233e63b831d46"), 0) --Run Retrospective Record (MIDI)

reaper.Main_OnCommand(reaper.NamedCommandLookup("_RS6e7d8e039b636d070ecfcbf6bd71c3728658a741"), 0) --Run Retrospective Record (audio)
heda is offline   Reply With Quote
Old 07-17-2019, 01:52 PM   #15
zookthespook
Human being with feelings
 
Join Date: Mar 2015
Location: India Mumbai
Posts: 816
Default

Quote:
Originally Posted by heda View Post
try this
also notice that the file has to have two _ underscore characters... not one. "__startup.lua"
I don't know why.



Code:
reaper.Main_OnCommand(reaper.NamedCommandLookup("_RSe3ad1140dc733c3ccfe65a67ec53bfc634535821"), 0) --Run Track Inspector VIP

reaper.Main_OnCommand(reaper.NamedCommandLookup("_RS67fdf22be642a98b636a7c6eadf233e63b831d46"), 0) --Run Retrospective Record (MIDI)

reaper.Main_OnCommand(reaper.NamedCommandLookup("_RS6e7d8e039b636d070ecfcbf6bd71c3728658a741"), 0) --Run Retrospective Record (audio)
oh yes ! thanks heda . trying it right away !

it worked it worked...you have taken me beyond "hello world" Really wan't to thank you for helping out here. this is going to be of great help !

regards
zook
zookthespook is offline   Reply With Quote
Old 10-03-2019, 08:30 AM   #16
Buy One
Human being with feelings
 
Buy One's Avatar
 
Join Date: Sep 2019
Posts: 1,134
Default

Is this function only available in the latest build?
Buy One is online now   Reply With Quote
Old 10-03-2019, 08:46 AM   #17
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

Quote:
Originally Posted by Buy One View Post
Is this function only available in the latest build?
It's been there for at least a year.
__________________
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-03-2019, 10:39 AM   #18
Buy One
Human being with feelings
 
Buy One's Avatar
 
Join Date: Sep 2019
Posts: 1,134
Default

Quote:
Originally Posted by Lokasenna View Post
It's been there for at least a year.
alright, thank you for the info
Buy One is online now   Reply With Quote
Old 10-04-2019, 07:11 AM   #19
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by Buy One View Post
Is this function only available in the latest build?
__startup.lua and __startup.eel are in there for at least three years, probably longer.
We use it for our Ultraschall-extension for some years now.

Main_OnCommand is available for even longer.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 06-24-2020, 10:58 AM   #20
Infrabass
Human being with feelings
 
Join Date: Apr 2014
Posts: 398
Default

I'm wondering if there is a way to execute a script on EVERY projet load, including in new tab?

The __startup.lua script and SWS global startup option are calling script only on Reaper load and the SWS project startup option is project dependent.

I would need something in the middle, something that execute a script for EVERY projets: existing ones, new ones, open in a tab or not.

Thank you!
Infrabass is offline   Reply With Quote
Old 06-25-2020, 08:28 AM   #21
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Quote:
Originally Posted by Infrabass View Post
I'm wondering if there is a way to execute a script on EVERY projet load, including in new tab?

The __startup.lua script and SWS global startup option are calling script only on Reaper load and the SWS project startup option is project dependent.

I would need something in the middle, something that execute a script for EVERY projets: existing ones, new ones, open in a tab or not.
What does the script (that you want to execute) do exactly? Can you post more details?
__________________
ReaLauncher
solger is offline   Reply With Quote
Old 06-25-2020, 09:13 AM   #22
Meo-Ada Mespotine
Human being with feelings
 
Meo-Ada Mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig
Posts: 6,621
Default

Quote:
Originally Posted by Infrabass View Post
I'm wondering if there is a way to execute a script on EVERY projet load, including in new tab?

The __startup.lua script and SWS global startup option are calling script only on Reaper load and the SWS project startup option is project dependent.

I would need something in the middle, something that execute a script for EVERY projets: existing ones, new ones, open in a tab or not.

Thank you!
I'll write you something.
__________________
Use you/she/her.Ultraschall-Api Lua Api4Reaper - Donate, if you wish

On vacation for the time being...
Meo-Ada Mespotine is offline   Reply With Quote
Old 06-25-2020, 09:52 AM   #23
Infrabass
Human being with feelings
 
Join Date: Apr 2014
Posts: 398
Default

Quote:
Originally Posted by solger View Post
What does the script (that you want to execute) do exactly? Can you post more details?
Actually it's pretty complex to explain. Basically I created a script to manage the way Reaper is copying the files into the project folder (called on each manual project save).
2 reasons for this:
- Because the option "copy media to project folder” failed to copy item pasted from an other Reaper project tab
- Because I copy the files into specific folders depending of its purpose: "Imported", "Reference" and "Internal". That way, I can easily see what were my sources for a given session because they are isolated from the internal glueing/printing files and the reference files (used to compare previous audio assets with the one I need to design).

So when I reopen a project where the files were managed that way I need to relink the items now offline with the copied source file now into the project folder.
And I want that process to be streamlined, so I even don't think about it.

Hope I was clear enough! :-)
Infrabass is offline   Reply With Quote
Old 06-25-2020, 09:56 AM   #24
Infrabass
Human being with feelings
 
Join Date: Apr 2014
Posts: 398
Default

Quote:
Originally Posted by Meo-Ada Mespotine View Post
I'll write you something.
Wow!
Very nice of you Mespotine!

Actually I found that I can set a project startup action on a template project and that when saved as a new project it keeps the startup project action set via the SWS action. So using that system it works really well!

Actually I have another question for you but it will be on another thread or maybe on the Reaper slack!
:-)

Cheers!
Infrabass is offline   Reply With Quote
Old 07-24-2022, 06:12 AM   #25
sockmonkey72
Human being with feelings
 
sockmonkey72's Avatar
 
Join Date: Sep 2021
Location: Berlin
Posts: 1,935
Default

Reviving this, and the project template idea is also good, but here is an extension to run a script when any project loads.
__________________
ReaPack Repository: right-click and copy index URL
sockmonkey72 is online now   Reply With Quote
Old 09-28-2022, 10:06 AM   #26
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 19,677
Default

I am experimenting with __start.lua

I have two scripts which have GUIs and are programmed to be docked when they are run.

If I add one of these as the SWS Global Startup then it is loaded and docked and waits for user input. All as intended.

If I put in __start/lua instead (having removed it from SWS Global) then, on start-up, it is loaded and docked. But its tab in the Docker is then selected and I have to click another tab to get the one I want.

Is there any was to stop that script's tab being selected?
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
DarkStar is offline   Reply With Quote
Old 09-28-2022, 12:49 PM   #27
bFooz
Human being with feelings
 
Join Date: Jul 2010
Location: Slovakia
Posts: 2,588
Default

Instead of putting multiple scripts into one global script, you can use a simple native custom action and put all the scripts into that. I use it this way.
bFooz is offline   Reply With Quote
Old 09-28-2022, 02:02 PM   #28
WarrenG
Human being with feelings
 
WarrenG's Avatar
 
Join Date: Jan 2020
Location: In the studio at my desk
Posts: 360
Default

I have been using the Start.lua for a few months now, but no matter how the script requests are oriented Track_Tags always take focus. I would prefer it to be HEDA TrackInsp


reaper.Main_OnCommand( reaper.NamedCommandLookup("_RSaea4bc032a8e5652fe85 818e22f6a1a1b38557f3"), 0) -- TRACK_TAGS
reaper.Main_OnCommand( reaper.NamedCommandLookup("_RS5d05bf5141d15a2fac58 7ca059eadcb12277ff84"), 0) -- Fabian_MFXlist
reaper.Main_OnCommand( reaper.NamedCommandLookup("_RS490460a16d7e7bb0285c cb1891b67f8f59593a61"), 0) -- QUCIK_ADDER
reaper.Main_OnCommand( reaper.NamedCommandLookup("_RS5b8bf3e80fd3616513f9 eb382b4923402608cfc8"), 0) -- HeDa_TrackInsp

Will the -1, -2 etc instead of , 0) resolve this?

Thanks
Warren
WarrenG is offline   Reply With Quote
Old 09-29-2022, 04:06 AM   #29
DarkStar
Human being with feelings
 
DarkStar's Avatar
 
Join Date: May 2006
Location: Surrey, UK
Posts: 19,677
Default

Quote:
Originally Posted by bFooz View Post
Instead of putting multiple scripts into one global script, you can use a simple native custom action and put all the scripts into that. I use it this way.
Hmm, I created a new Custom Action with the 2 scripts in it. Then selected that Custom Action as the SWS Global Start-up. On start up, Reaper got to the prompt to Save a new project, as usual. After that Reaper did not respond to any clicks and used 75% CPU! I had to terminate the task from the Task Manager. That's a first for me.

Oddly, I could not find the Custom Action (to remove it) nor where it is stored in the SWS ini files. I had to rename the SWS dll file, restart Reaper, delete the Custom Action, close Reaper, restore the SWS dll, restart Reaper.

So it does not seem that I can run 2 scripts on startup without them both being focussed in the Dockers. I wonder what the second parameter in the reaper.Main_OnCommand() does; it is not documented.
__________________
DarkStar ... interesting, if true. . . . Inspired by ...
DarkStar is offline   Reply With Quote
Old 09-29-2022, 05:16 AM   #30
bFooz
Human being with feelings
 
Join Date: Jul 2010
Location: Slovakia
Posts: 2,588
Default

I have 12 scripts starting up in the startup custom action. But only one of them is graphical, the rest is just deferred without ui.
bFooz 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 09:13 AM.


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