Python
From CockosWiki
(Difference between revisions)
(→Recommended Script Editors) |
(→Example Scripts) |
||
Line 44: | Line 44: | ||
|- | |- | ||
| [[QuickName.py]]||opens a dialog box to ask user for new media item take name||liteon | | [[QuickName.py]]||opens a dialog box to ask user for new media item take name||liteon | ||
+ | |- | ||
+ | | [[GetSourceExtension.py]]||testing the extension of one selected item ||EvilDragon | ||
|} | |} | ||
Revision as of 14:23, 14 December 2009
Reaper Documentation/ReaScript
Contents |
Introduction
Multiple Versions of Python Installed
If you have both Python 2 and 3 installed, you can try this from Reaper 3.1415:
In REAPER.ini, the [reaper] section which is usually the top 50% of the file, add a line like this:
pythonlib=/Library/Frameworks/Python.framework/Versions/3.1/lib/libpython3.1.dylib
(Your path to the Python 3 dylib is probably different - so don't just copy the line above...)
Caveats
Recommended Script Editors
IDLE - which is included in more recent Python distributions.
Notepad++
PSPad
Coding Tips
Function Aliasing
You can use function aliasing to reduce the length of your code in cases where a function is used many times. For example:
def msg(m): RPR_ShowConsoleMsg(m) # ------------------------ # so now you can write msg() instead of RPR_ShowConsoleMsg() each time
Example Scripts
Script Name | Description | Contributed by |
---|---|---|
HappySnake.py | Coding example in the form of ASCII prank: | liteon |
RemoveTakeNamesExtensions.py | A Python version of sfzgeek's Perl script | EvilDragon |
SetCustomColour.py | This script sets the track colour if just the track is selected and the item colour if just the item is suggested | EvilDragon |
SoxConvert.py | Sample rate conversion with SOX and ReaScript | dub3000 |
QuickName.py | opens a dialog box to ask user for new media item take name | liteon |
GetSourceExtension.py | testing the extension of one selected item | EvilDragon |