Python

From CockosWiki

(Difference between revisions)
Jump to: navigation, search
(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 NameDescriptionContributed by
HappySnake.pyCoding example in the form of ASCII prank:liteon
RemoveTakeNamesExtensions.pyA Python version of sfzgeek's Perl scriptEvilDragon
SetCustomColour.pyThis script sets the track colour if just the track is selected and the item colour if just the item is suggestedEvilDragon
SoxConvert.pySample rate conversion with SOX and ReaScriptdub3000
QuickName.pyopens a dialog box to ask user for new media item take nameliteon
GetSourceExtension.pytesting the extension of one selected item EvilDragon
Reaper Documentation/ReaScript
Personal tools