Python

From CockosWiki

(Difference between revisions)
Jump to: navigation, search
m (Example Scripts)
(Example Scripts)
Line 48: Line 48:
|-
|-
| [[GuiTest.py]]||Short demonstration of the TK Gui - excellent stuff which solves a lot of problems||Malevol3nt
| [[GuiTest.py]]||Short demonstration of the TK Gui - excellent stuff which solves a lot of problems||Malevol3nt
 +
|-
 +
| [[MoveToNextEdit.py]] & [[MoveToPrevEdit.py]]||Moves the cursor to the next, or previous "edit point". In this context an edit point is a project marker, project start or end, item start and end points, and fade points. The two scripts are nearly identical with just a single variable specifying which way to search in the project.|| ThomasE
|}
|}
Line 54: Line 56:
[[Category:ReaScript]]
[[Category:ReaScript]]
-
[[Reaper_Documentation|Reaper Documentation]]/[[ReaScript]]
+
[[Reaper_Documentation|Reaper Documentation]] > [[ReaScript]]

Revision as of 22:03, 17 January 2010

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
GuiTest.pyShort demonstration of the TK Gui - excellent stuff which solves a lot of problemsMalevol3nt
MoveToNextEdit.py & MoveToPrevEdit.pyMoves the cursor to the next, or previous "edit point". In this context an edit point is a project marker, project start or end, item start and end points, and fade points. The two scripts are nearly identical with just a single variable specifying which way to search in the project. ThomasE
Reaper Documentation > ReaScript
Personal tools