Old 09-27-2015, 04:52 PM   #1
przemoc
Human being with feelings
 
przemoc's Avatar
 
Join Date: Sep 2015
Location: Poland
Posts: 33
Default EEL: Set time selection to items on selected tracks

(Parent thread: Przemoc's ReaScripts)

Necessity is the mother of invention, so I'm joining the community of ReaScripters with very modest script for starters. I read about scattered EEL knowledge in pages dedicated to ReaScript at REAPER SDK and ReaScript documentation generated from REAPER. I cannot say I love EEL syntax, but it does have some inner beauty in its simplicity, so I thought: why not write something in it and improve my workflow along the way? Next I looked into some existing user scripts to get a bit more familiar with it. Then I applied my conventions regarding C/C++ programming to start developing my own (IMHO clean and readable, I always strive for these traits in code) EEL style. And in the end I finished the script. Without further ado, here it is:

PPP - Set time selection to items on selected tracks.eel

Only after creating this script I have noticed, that it can be imitated using custom action with following steps:
  • SWS: Save selected items,
  • Item: Select all items in track,
  • Time selection: Set time selection to items,
  • SWS: Restore saved selected items.

Anyway, I find dedicated script/function much cleaner. I believe that (some) others here may share this mindset. Hope my script will help you to save a few seconds a day or at least a year.

You can view/download raw script using convenient shortlink:
http://git.io/PPP_SetTimeSelToItemsOnSelTracks.eel
__________________
@SoundCloud | ReaScripts @GitHub @Forum | SP4-7 ReaBank | Viewing new posts | REQ Samples
REAPER v7.x @ NUC11PHKi7C [Core i7-1165G7 @ 2.8GHz, DDR4-3200 32GB RAM, RTX 2060] | W11
REAPER v5.99 @ ThinkPad T430 [Core i7 3520M @ 2.9GHz, DDR3-1600 8GB RAM, NVS 5400M] | W7

Last edited by przemoc; 09-04-2016 at 02:55 AM. Reason: Added new parent thread link
przemoc is offline   Reply With Quote
Old 09-28-2015, 04:50 AM   #2
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Hi !

Thanks for sharing

Indeed, EEL is pretty simple... Until we have to face complex strings operations, and tables.
There is some limitations of the language, you can't for example build multi dimensional arrays.

That's why most advanced scripts out there are in Lua.

But yes, some people successively mastered EEL in a very impressive way, but I think Lua is more simple to learn, due to its syntax and it's flexibility.

Anyway, feel free to pursue your script journey with EEL if you like it, it pretty easy to switch from this language to Lua
X-Raym is offline   Reply With Quote
Old 09-28-2015, 06:09 AM   #3
przemoc
Human being with feelings
 
przemoc's Avatar
 
Join Date: Sep 2015
Location: Poland
Posts: 33
Default

Quote:
Originally Posted by X-Raym View Post
Thanks for sharing
You're welcome!
But from what I realized during ReaScript resources hunting (and I've already seen some of your docs and scripts, obviously) you're one of people that possibly benefits the least from such simple scripts, because you have written tons of them already and writing another one of that kind would be a no-brainer for you.

Quote:
Originally Posted by X-Raym View Post
Indeed, EEL is pretty simple... Until we have to face complex strings operations, and tables.
There is some limitations of the language, you can't for example build multi dimensional arrays.
EEL is simple or, what I avoided writing in my first post in reascript part of the forum, possibly overly simple from scripter PoV. Number-based string handling is clunky and I didn't need tables yet, so cannot rant about them yet.

Quote:
Originally Posted by X-Raym View Post
That's why most advanced scripts out there are in Lua.
Lua is great for many reasons. I had some minor experience with it before (even from the other side of the fence - maintaining and fixing some server embedding Lua in one of my previous jobs). I would like more C-ish syntax, but Lua can be bearable. I always hated lack of 64-bit ints (for the same reason I cannot seriously think about JS), though. Lua 5.3 finally fixed this by introducing integer subtype (so I clearly understand why Cockos devs didn't approach Lua earlier). LuaJIT had its own approach before. This is another thing why I'm not that fond of Lua, its community is more or less divided between 3 camps: Lua up to 5.1/5.2, LuaJIT (which is mostly 5.1 compatible with some stuff from 5.2) and newly emerged Lua 5.3+. Various Luas are used in various places.

Quote:
Originally Posted by X-Raym View Post
But yes, some people successively mastered EEL in a very impressive way, but I think Lua is more simple to learn, due to its syntax and it's flexibility.
Thanks for the link, I'll check it later. Having parentheses for block scoping instead of curly braces or using ?: as if-else is something that feels awkward and hard to learn in EEL.

Quote:
Originally Posted by X-Raym View Post
Anyway, feel free to pursue your script journey with EEL if you like it, it pretty easy to switch from this language to Lua
I wanted to try EEL, becuase I knew completely nothing about it and it looked C-ish enough to appeal to me. I may definitely try Lua for ReaScripts in future if EEL won't be enough.
__________________
@SoundCloud | ReaScripts @GitHub @Forum | SP4-7 ReaBank | Viewing new posts | REQ Samples
REAPER v7.x @ NUC11PHKi7C [Core i7-1165G7 @ 2.8GHz, DDR4-3200 32GB RAM, RTX 2060] | W11
REAPER v5.99 @ ThinkPad T430 [Core i7 3520M @ 2.9GHz, DDR3-1600 8GB RAM, NVS 5400M] | W7
przemoc is offline   Reply With Quote
Old 09-28-2015, 09:16 AM   #4
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 9,875
Default

Of course Feel free to use it if you like it, and if it does the job, in a simple way !
Most of my simpler early days scripts were EEL, too, and they works just as fine as if they were written in Lua.

Quote:
you're one of people that possibly benefits the least from such simple scripts,
I am thankful for the gift you made to the community
Scripting and sharing have to be encourage !
X-Raym is offline   Reply With Quote
Old 09-28-2015, 09:46 AM   #5
przemoc
Human being with feelings
 
przemoc's Avatar
 
Join Date: Sep 2015
Location: Poland
Posts: 33
Default

Quote:
Originally Posted by X-Raym View Post
I am thankful for the gift you made to the community
Scripting and sharing have to be encourage !
Fair enough. And thanks for encouraging REAPER users to dive into ReaScripts realms!
__________________
@SoundCloud | ReaScripts @GitHub @Forum | SP4-7 ReaBank | Viewing new posts | REQ Samples
REAPER v7.x @ NUC11PHKi7C [Core i7-1165G7 @ 2.8GHz, DDR4-3200 32GB RAM, RTX 2060] | W11
REAPER v5.99 @ ThinkPad T430 [Core i7 3520M @ 2.9GHz, DDR3-1600 8GB RAM, NVS 5400M] | W7
przemoc 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:11 AM.


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