<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><base href="http://www.reaper.fm/sdk/reascript/reascript.php"><!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><title> REAPER | ReaScript </title><link rel=Stylesheet type="text/css" media=all href="http://www.reaper.fm/general4.css"><style><!--
/* Font Definitions */
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Trebuchet MS";
        panose-1:2 11 6 3 2 2 2 2 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#A8B3B3;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#A8B3B3;
        text-decoration:underline;}
code
        {mso-style-priority:99;
        font-family:"Courier New";}
p.navbutton, li.navbutton, div.navbutton
        {mso-style-name:navbutton;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.greenblock, li.greenblock, div.greenblock
        {mso-style-name:greenblock;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.menuitem, li.menuitem, div.menuitem
        {mso-style-name:menuitem;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:9.0pt;
        font-family:"Times New Roman","serif";}
p.menuitemsub, li.menuitemsub, div.menuitemsub
        {mso-style-name:menuitem_sub;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:9.0pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";
        color:#9DABAB;}
p.maincolsubheading, li.maincolsubheading, div.maincolsubheading
        {mso-style-name:maincol_subheading;
        mso-margin-top-alt:auto;
        margin-right:0in;
        margin-bottom:11.25pt;
        margin-left:0in;
        font-size:15.0pt;
        font-family:"Times New Roman","serif";
        color:#EBF2F2;
        font-weight:bold;}
p.inlineimgblock, li.inlineimgblock, div.inlineimgblock
        {mso-style-name:inlineimg_block;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.inlineimgleft, li.inlineimgleft, div.inlineimgleft
        {mso-style-name:inlineimg_left;
        mso-margin-top-alt:auto;
        margin-right:7.5pt;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
p.inlineimgright, li.inlineimgright, div.inlineimgright
        {mso-style-name:inlineimg_right;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:7.5pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle26
        {mso-style-type:personal-compose;
        font-family:"Trebuchet MS","sans-serif";
        color:#A8B3B3;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
/* List Definitions */
@list l0
        {mso-list-id:83500634;
        mso-list-template-ids:349458632;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Symbol;}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:1.0in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:"Courier New";
        mso-bidi-font-family:"Times New Roman";}
@list l0:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:1.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:2.0in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level5
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:2.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:3.0in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:3.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level8
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:4.0in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l0:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:4.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1
        {mso-list-id:808059325;
        mso-list-template-ids:-1232068082;}
@list l1:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Symbol;}
@list l1:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:1.0in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:"Courier New";
        mso-bidi-font-family:"Times New Roman";}
@list l1:level3
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:1.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level4
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:2.0in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level5
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:2.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level6
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:3.0in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level7
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:3.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level8
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:4.0in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
@list l1:level9
        {mso-level-number-format:bullet;
        mso-level-text:\F0A7;
        mso-level-tab-stop:4.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Wingdings;}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body bgcolor="#333333" lang=EN-US link="#A8B3B3" vlink="#A8B3B3"><div class=WordSection1><p class=MsoNormal style='line-height:120%'><span style='font-family:"Trebuchet MS","sans-serif";color:#A8B3B3'>Hi Folks:<o:p></o:p></span></p><p class=MsoNormal style='line-height:120%'><span style='font-family:"Trebuchet MS","sans-serif";color:#A8B3B3'><o:p> </o:p></span></p><p class=MsoNormal style='line-height:120%'><span style='font-family:"Trebuchet MS","sans-serif";color:#A8B3B3'>I found this information and copied it to this email wondering if RayScript can bring better access to Reaper.<o:p></o:p></span></p><p class=MsoNormal style='line-height:120%'><span style='font-family:"Trebuchet MS","sans-serif";color:#A8B3B3'><o:p> </o:p></span></p><div id="layout_wrapper"><div style='margin-top:15.0pt'><div style='margin-left:15.0pt;margin-right:15.0pt'><div style='margin-bottom:7.5pt' id="sidebox_1"><div style='margin-left:15.0pt;margin-right:15.0pt'><div style='margin-bottom:11.25pt'><p class=MsoNormal style='line-height:120%;background:#9DABAB'><b><span style='font-size:15.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#EBF2F2'>ReaScript <o:p></o:p></span></b></p></div><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:6.0pt;text-indent:-.25in;line-height:120%;mso-list:l0 level1 lfo1;background:#9DABAB'><![if !supportLists]><span style='font-size:10.0pt;line-height:120%;font-family:Symbol;color:#171A1A'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>         </span></span></span><![endif]><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><a href="reascript.php#reascript_intro"><span style='color:#171A1A'>Introduction</span></a> <o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:6.0pt;text-indent:-.25in;line-height:120%;mso-list:l0 level1 lfo1;background:#9DABAB'><![if !supportLists]><span style='font-size:10.0pt;line-height:120%;font-family:Symbol;color:#171A1A'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>         </span></span></span><![endif]><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><a href="reascript.php#reascript_requirements"><span style='color:#171A1A'>Requirements</span></a> <o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:6.0pt;text-indent:-.25in;line-height:120%;mso-list:l0 level1 lfo1;background:#9DABAB'><![if !supportLists]><span style='font-size:10.0pt;line-height:120%;font-family:Symbol;color:#171A1A'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>         </span></span></span><![endif]><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><a href="reascript.php#reascript_doc"><span style='color:#171A1A'>ReaScript Documentation and Reference</span></a> <o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:6.0pt;text-indent:-.25in;line-height:120%;mso-list:l0 level1 lfo1;background:#9DABAB'><![if !supportLists]><span style='font-size:10.0pt;line-height:120%;font-family:Symbol;color:#171A1A'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>         </span></span></span><![endif]><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><a href="reascript.php#reascript_run"><span style='color:#171A1A'>Running ReaScripts</span></a> <o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:6.0pt;text-indent:-.25in;line-height:120%;mso-list:l0 level1 lfo1;background:#9DABAB'><![if !supportLists]><span style='font-size:10.0pt;line-height:120%;font-family:Symbol;color:#171A1A'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>         </span></span></span><![endif]><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><a href="reascript.php#reascript_actions"><span style='color:#171A1A'>Calling REAPER Actions</span></a> <o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:6.0pt;text-indent:-.25in;line-height:120%;mso-list:l0 level1 lfo1;background:#9DABAB'><![if !supportLists]><span style='font-size:10.0pt;line-height:120%;font-family:Symbol;color:#171A1A'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>         </span></span></span><![endif]><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><a href="reascript.php#reascript_ext"><span style='color:#171A1A'>ReaScript API</span></a> <o:p></o:p></span></p><p class=MsoNormal style='mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;margin-left:6.0pt;text-indent:-.25in;line-height:120%;mso-list:l0 level1 lfo1;background:#9DABAB'><![if !supportLists]><span style='font-size:10.0pt;line-height:120%;font-family:Symbol;color:#171A1A'><span style='mso-list:Ignore'>·<span style='font:7.0pt "Times New Roman"'>         </span></span></span><![endif]><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><a href="reascript.php#reascript_adv"><span style='color:#171A1A'>Advanced</span></a> <o:p></o:p></span></p><p class=MsoNormal style='line-height:120%;background:#9DABAB'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><br><br><br><o:p></o:p></span></p><div class=MsoNormal align=center style='text-align:center;line-height:120%;background:#9DABAB'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><hr size=2 width="100%" align=center></span></div><p class=MsoNormal style='margin-bottom:12.0pt;line-height:120%;background:#9DABAB'><span style='font-size:7.5pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><u>top</u></span><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'>  </span><a name="reascript_intro"><b><span style='font-family:"Trebuchet MS","sans-serif";color:#171A1A'>Introduction</span></b></a><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'> <br><br>ReaScript is a feature that allows you to run Python scripts within REAPER. From within the script, you can call any REAPER action, and also call back into most of the REAPER API functions (the same API used by compiled REAPER plug-ins and extensions). ReaScript can be used to create anything from advanced macros to full-featured REAPER extensions. <br><br>Note: REAPER on Windows formerly supported Perl scripts as well, but Perl support was removed in REAPER version 4.14. ReaScript Perl will be reinstated when/if the Perl <a href="http://gitorious.org/perl-ctypes" target="_blank"><span style='color:#171A1A'>ctypes project</span></a> is complete. <o:p></o:p></span></p><div class=MsoNormal align=center style='text-align:center;line-height:120%;background:#9DABAB'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><hr size=2 width="100%" align=center></span></div><p class=MsoNormal style='margin-bottom:12.0pt;line-height:120%;background:#9DABAB'><span style='font-size:7.5pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><u>top</u></span><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'>  </span><a name="reascript_requirements"><b><span style='font-family:"Trebuchet MS","sans-serif";color:#171A1A'>Requirements</span></b></a><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'> <br><br>To use ReaScript, you must have Python installed on your computer. ReaScript should work with any version of Python between 2.7 and the current 3.x release. <br><br>OS X normally comes with Python already installed. If you don't already have Python, it is available as a free download for Windows or Mac from multiple sources. For 32-bit REAPER, you need 32-bit Python (regardless of the operating system). For 64-bit REAPER, you need 64-bit Python. <br><br>A list of Python distributions is <a href="http://www.python.org/download/" target="_blank"><span style='color:#171A1A'>here.</span></a> <br><br>Once Python is installed, REAPER should automatically detect it, and ReaScript will work. If REAPER does not detect Python, you can enter the Python install directory in REAPER preferences, under Plug-Ins/ReaScript. <o:p></o:p></span></p><div class=MsoNormal align=center style='text-align:center;line-height:120%;background:#9DABAB'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><hr size=2 width="100%" align=center></span></div><p class=MsoNormal style='margin-bottom:12.0pt;line-height:120%;background:#9DABAB'><span style='font-size:7.5pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><u>top</u></span><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'>  </span><a name="reascript_doc"><b><span style='font-family:"Trebuchet MS","sans-serif";color:#171A1A'>ReaScript Documentation and Reference</span></b></a><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'> <br><br>From within REAPER, under the Help menu, choose "HTML lists/ReaScript documentation". This will open a web page with some basic documentation, and a complete list of all REAPER API functions that can be called from ReaScript. <br><br>There is extensive online documentation for <a href="http://docs.python.org/" target="_blank"><span style='color:#171A1A'>Python 2</span></a> and <a href="http://docs.python.org/py3k/" target="_blank"><span style='color:#171A1A'>Python 3</span></a>. <o:p></o:p></span></p><div class=MsoNormal align=center style='text-align:center;line-height:120%;background:#9DABAB'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><hr size=2 width="100%" align=center></span></div><p class=MsoNormal style='line-height:120%;background:#9DABAB'><span style='font-size:7.5pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><u>top</u></span><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'>  </span><a name="reascript_run"><b><span style='font-family:"Trebuchet MS","sans-serif";color:#171A1A'>Running ReaScripts</span></b></a><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'> <br><br>You will need to either write a script, or copy a script from another user. Scripts can be placed anywhere on your disk, but it's convenient to keep them all in the REAPER/Scripts application data directory. <br><br>To write a new script, show the Actions list (bound to the ? key by default), and click ReaScript: New/Load. You will be prompted for the location to save your new script. The default location is the recommended REAPER/Scripts application data directory. Name your script something like test.py, then click ReaScript: Edit. A text editor will open. <br><br>The simplest possible ReaScript is:<br><br></span><code><span style='font-size:10.0pt;line-height:120%;color:#171A1A'>RPR_APITest()</span></code><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><br><br>Save the ReaScript, and then click Run. You should see a window that says "Test OK". Common reasons for the script failing are: <o:p></o:p></span></p><ul type=disc><li class=MsoNormal style='color:#171A1A;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:120%;mso-list:l1 level1 lfo2;background:#9DABAB'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif"'>Python not installed <o:p></o:p></span></li><li class=MsoNormal style='color:#171A1A;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:120%;mso-list:l1 level1 lfo2;background:#9DABAB'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif"'>REAPER cannot find the installed Python <o:p></o:p></span></li><li class=MsoNormal style='color:#171A1A;mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;line-height:120%;mso-list:l1 level1 lfo2;background:#9DABAB'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif"'>Syntax error (typo, missing newline, incorrect indentation in Python) <o:p></o:p></span></li></ul><p class=MsoNormal style='margin-bottom:12.0pt;line-height:120%;background:#9DABAB'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'>You can treat a ReaScript just like any custom action: bind it to a key shortcut, MIDI controller, or toolbar button. ReaScripts can also be run a la carte, via the actions "ReaScript: run..." and "ReaScript: run last script". <o:p></o:p></span></p><div class=MsoNormal align=center style='text-align:center;line-height:120%;background:#9DABAB'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><hr size=2 width="100%" align=center></span></div><p class=MsoNormal style='margin-bottom:12.0pt;line-height:120%;background:#9DABAB'><span style='font-size:7.5pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><u>top</u></span><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'>  </span><a name="reascript_actions"><b><span style='font-family:"Trebuchet MS","sans-serif";color:#171A1A'>Calling REAPER Actions</span></b></a><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'> <br><br>You can call any REAPER action from ReaScript by using the API function<br><br></span><code><span style='font-size:10.0pt;line-height:120%;color:#171A1A'>RPR_Main_OnCommand(actionnumber, 0)</span></code><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><br><br>Find the action number for a given action by opening the Actions list, and scrolling the window right to reveal an extra column. For example, from ReaScript you would call the REAPER action "Item: Split item under mouse cursor" like this:<br><br></span><code><span style='font-size:10.0pt;line-height:120%;color:#171A1A'>RPR_Main_OnCommand(40746, 0)</span></code><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><br><br>If you use ReaScript as an advanced macro language, this is the only API function you need to know. <o:p></o:p></span></p><div class=MsoNormal align=center style='text-align:center;line-height:120%;background:#9DABAB'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><hr size=2 width="100%" align=center></span></div><p class=MsoNormal style='margin-bottom:12.0pt;line-height:120%;background:#9DABAB'><span style='font-size:7.5pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><u>top</u></span><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'>  </span><a name="reascript_ext"><b><span style='font-family:"Trebuchet MS","sans-serif";color:#171A1A'>ReaScript API</span></b></a><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'> <br><br>ReaScripts also have access to most of the <a href="http://www.reaper.fm/sdk/plugin/plugin.php"><span style='color:#171A1A'>REAPER Extension API</span></a> functions. For a list of all API functions available to ReaScripts, see the <a href="#reascript_doc"><span style='color:#171A1A'>built-in ReaScript documentation</span></a>. That help page will explain the basics of how to call API functions, which may require idiosyncratic syntax, because API functions can return information in the parameter list as well as the function return value. For convenience, there are also basic API functions for getting information from, and showing information to, the user. <o:p></o:p></span></p><div class=MsoNormal align=center style='text-align:center;line-height:120%;background:#9DABAB'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><hr size=2 width="100%" align=center></span></div><p class=MsoNormal style='margin-bottom:12.0pt;line-height:120%;background:#9DABAB'><span style='font-size:7.5pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><u>top</u></span><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'>  </span><a name="reascript_adv"><b><span style='font-family:"Trebuchet MS","sans-serif";color:#171A1A'>Advanced</span></b></a><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'> <br><br>You can set a custom editor for Python scripts in REAPER's Preferences/External Editors, by assigning an application to the ".py" extension. <br><br>ReaScripts can keep persistent state by using the API functions RPR_SetExtState() and RPR_GetExtState(). This allows ReaScripts to set key/value pairs (similar to a Python dictionary) that will persist between ReaScripts, and optionally persist between REAPER instances as well. For example, a module called "utility" might want to remember that some flag is set: <br><br></span><code><span style='font-size:10.0pt;line-height:120%;color:#171A1A'>RPR_SetExtState("utility", "someflag", "2", True)</span></code><span style='font-size:10.0pt;line-height:120%;font-family:"Courier New";color:#171A1A'><br><code>val=RPR_GetExtState("utility", "someflag") # even if called after REAPER is closed and reopened, val will be equal to "2" </code></span><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><br><br>You can create and save modules of useful functions that you can import into other ReaScripts. For example, if you create a file called reascript_utility.py that contains the function helpful_function(), you can import that file into any ReaScript with the line <br><br></span><code><span style='font-size:10.0pt;line-height:120%;color:#171A1A'>import reascript_utility</span></code><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'> <br><br>and call the function by using <br><br></span><code><span style='font-size:10.0pt;line-height:120%;color:#171A1A'>reascript_utility.helpful_function()</span></code><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'> <br><br>Note that reascript_utility.py must itself import reaper_python, with the line <br><br></span><code><span style='font-size:10.0pt;line-height:120%;color:#171A1A'>from reaper_python import *</span></code><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'> <br><br>(Although it is not required, it is good practice to start all ReaScripts with that line.) <o:p></o:p></span></p><div class=MsoNormal align=center style='text-align:center;line-height:120%;background:#9DABAB'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><hr size=2 width="100%" align=center></span></div><p class=MsoNormal style='line-height:120%;background:#9DABAB'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#171A1A'><br>For more help on ReaScript, to report bugs, to request additional API functions, to share ReaScripts, or just to discuss the possibilities, please use the <br><a href="http://forum.cockos.com/forumdisplay.php?f=3"><span style='color:#171A1A'>REAPER ReaScript Forum.</span></a> <o:p></o:p></span></p></div></div></div></div></div><div id=footer><div id="footer_link"><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#A8B3B3'><img border=0 width=32 height=32 id="_x0000_i1033" src="cid:image003.jpg@01CE0910.2CBB1D30" alt="http://www.reaper.fm/siteimages/to_top.jpg"></span><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#A8B3B3'><o:p></o:p></span></p></div><div id=menuitems><div><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:azure'><a href="../../index.php"><span style='color:azure;text-decoration:none'>Home </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="http://www.cockos.com/company.php"><span style='color:#9DABAB;text-decoration:none'>Company </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../reviews.php"><span style='color:#9DABAB;text-decoration:none'>Reviews </span></a><o:p></o:p></span></p></div><div><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:azure'><a href="../../about.php"><span style='color:azure;text-decoration:none'>About </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../aboutusers.php"><span style='color:#9DABAB;text-decoration:none'>Uses </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../aboutaudio.php"><span style='color:#9DABAB;text-decoration:none'>Audio </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../aboutmidi.php"><span style='color:#9DABAB;text-decoration:none'>MIDI </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../technical.php"><span style='color:#9DABAB;text-decoration:none'>Technical </span></a><o:p></o:p></span></p></div><div><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:azure'><a href="../../download.php"><span style='color:azure;text-decoration:none'>Download </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../userguide.php"><span style='color:#9DABAB;text-decoration:none'>User Guide </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../download-old.php"><span style='color:#9DABAB;text-decoration:none'>Old Versions </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../reaplugs/index.php"><span style='color:#9DABAB;text-decoration:none'>ReaPlugs </span></a><o:p></o:p></span></p></div><div><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:azure'><a href="../../purchase.php"><span style='color:azure;text-decoration:none'>Purchase </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../dist-agreement.php"><span style='color:#9DABAB;text-decoration:none'>Distribution </span></a><o:p></o:p></span></p></div><div><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:azure'><a href="../../reference.php"><span style='color:azure;text-decoration:none'>Developer </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../sdk/walter/walter.php"><span style='color:#9DABAB;text-decoration:none'>Theme Development </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../sdk/cursors/cursors.php"><span style='color:#9DABAB;text-decoration:none'>Custom Cursors </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../sdk/js/js.php"><span style='color:#9DABAB;text-decoration:none'>JS Programming </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../sdk/reascript/reascript.php"><span style='color:white;text-decoration:none'>• </span><span style='color:#9DABAB;text-decoration:none'>ReaScript </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../sdk/plugin/plugin.php"><span style='color:#9DABAB;text-decoration:none'>Extensions SDK </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../sdk/vst/vst_ext.php"><span style='color:#9DABAB;text-decoration:none'>Extensions to VST SDK </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../sdk/osc/osc.php"><span style='color:#9DABAB;text-decoration:none'>OSC </span></a><o:p></o:p></span></p></div><div><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:azure'><a href="../../resources.php"><span style='color:azure;text-decoration:none'>Resources </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../forum.php"><span style='color:#9DABAB;text-decoration:none'>Forum </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="http://stash.reaper.fm"><span style='color:#9DABAB;text-decoration:none'>Stash </span></a><o:p></o:p></span></p></div><div style='margin-left:9.0pt'><p class=MsoNormal style='line-height:120%'><span style='font-size:9.0pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'><a href="../../wiki.php"><span style='color:#9DABAB;text-decoration:none'>Wiki </span></a><o:p></o:p></span></p></div></div><div id=copyright><p class=MsoNormal style='line-height:120%'><b><span style='font-size:7.5pt;line-height:120%;font-family:"Trebuchet MS","sans-serif";color:#9DABAB'>© 2005-2012 Cockos Incorporated <o:p></o:p></span></b></p></div></div></div></body></html>