Permalink
Browse files

Add method to spawn and send commands to a MATLAB process

There are two new bundle items: The first spawns a MATLAB process in Terminal and the second sends commands to the previously spawned process in Terminal.
  • Loading branch information...
Daniel Grady authored and infininight committed Nov 6, 2010
1 parent 0636a47 commit c6e9f02e17880a91eb1c52ea7a370e17902aa8b1
Showing with 96 additions and 6 deletions.
  1. +57 −0 Commands/Execute in MATLAB.tmCommand
  2. +32 −0 Commands/Spawn MATLAB.tmCommand
  3. +7 −6 info.plist
@@ -0,0 +1,57 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>#!/usr/bin/env osascript
+
+set das_inputzen to do shell script "cat"
+set mt to missing value
+
+tell application "Terminal"
+ repeat with w in every window
+ repeat with t from 1 to (count tabs of w)
+ if processes of item t of tabs of w contains "MATLAB" then
+ set mw to id of w
+ set mt to t
+ end if
+ end repeat
+ end repeat
+
+ if mt is not equal to missing value then
+ do script das_inputzen in tab mt of window id mw
+ end if
+end tell
+
+if mt is equal to missing value then
+ return "No running instances of MATLAB found."
+else
+ return
+end if
+</string>
+ <key>fallbackInput</key>
+ <string>line</string>
+ <key>input</key>
+ <string>selection</string>
+ <key>inputFormat</key>
+ <string>text</string>
+ <key>keyEquivalent</key>
+ <string>@r</string>
+ <key>name</key>
+ <string>Execute in Matlab</string>
+ <key>outputCaret</key>
+ <string>afterOutput</string>
+ <key>outputFormat</key>
+ <string>text</string>
+ <key>outputLocation</key>
+ <string>toolTip</string>
+ <key>scope</key>
+ <string>source.matlab</string>
+ <key>uuid</key>
+ <string>064E306B-FF23-432B-952F-55AC3BEF029E</string>
+ <key>version</key>
+ <integer>2</integer>
+</dict>
+</plist>
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+ <key>beforeRunningCommand</key>
+ <string>nop</string>
+ <key>command</key>
+ <string>#!/usr/bin/env osascript
+
+tell application "Terminal"
+ activate
+ do script "matlab -nosplash -nodesktop"
+end tell
+</string>
+ <key>input</key>
+ <string>none</string>
+ <key>inputFormat</key>
+ <string>text</string>
+ <key>name</key>
+ <string>Spawn Matlab</string>
+ <key>outputCaret</key>
+ <string>afterOutput</string>
+ <key>outputFormat</key>
+ <string>text</string>
+ <key>outputLocation</key>
+ <string>discard</string>
+ <key>uuid</key>
+ <string>07FBCD52-B897-4931-AE99-86C5B25C2132</string>
+ <key>version</key>
+ <integer>2</integer>
+</dict>
+</plist>
View
@@ -20,6 +20,9 @@
</array>
<key>items</key>
<array>
+ <string>07FBCD52-B897-4931-AE99-86C5B25C2132</string>
+ <string>064E306B-FF23-432B-952F-55AC3BEF029E</string>
+ <string>------------------------------------</string>
<string>78BBA099-C976-415C-AA88-FE596173D38D</string>
<string>8EDB89D6-79E4-4A26-8E14-ED60254782FB</string>
<string>B5959BD1-48FB-495C-A3C3-AE04B05774C7</string>
@@ -168,23 +171,21 @@
<string>Matlab</string>
<key>ordering</key>
<array>
+ <string>548092DA-0275-4312-9F4F-5FA6375B1B01</string>
+ <string>3D39FA94-9A43-4CB1-8C72-F262E5DBF96E</string>
<string>2CD1353B-AEC7-4BBF-8061-6038D1E93FA8</string>
+ <string>07FBCD52-B897-4931-AE99-86C5B25C2132</string>
+ <string>064E306B-FF23-432B-952F-55AC3BEF029E</string>
<string>D7A8ED42-49E0-4CF3-A6C8-BE8DAB76267A</string>
<string>87BC3C5B-627C-49AD-97B6-455345C1D478</string>
<string>563CDF89-C286-4CDB-94AB-30819104470F</string>
<string>1166137D-A579-484D-BDD7-AC62EFFA3FFA</string>
<string>9915BCE4-2499-4E17-9006-7BB08A8539F0</string>
- <string>178F5EE1-2953-4FB2-8623-99A1C7D0772F</string>
- <string>1F4C6EA6-370C-45A9-96C5-36E69CC297E3</string>
- <string>3C12382B-FD63-4DD8-9198-02D25AF755FF</string>
<string>A93C4844-87F4-4136-9580-75B697D0CFD7</string>
<string>2FED97FA-0EB0-45E3-B92F-757903E79684</string>
<string>3FFA60EB-FA14-47DE-AEF7-5A3E840BE637</string>
<string>F674E1B2-5BA5-4397-9D54-D48623E9F2FD</string>
- <string>7298E093-E86F-4A60-ACFF-67580F24FD27</string>
<string>876FEC4C-FD21-401A-8947-0B2E232E19CA</string>
- <string>4A86BFC8-5C03-45F8-B7D6-597F476E7C93</string>
- <string>EA7BD80E-6346-44E9-A909-CE0703CFB390</string>
<string>08CB1F21-B7EB-4AD7-B066-BB365966E390</string>
<string>ADE63DB1-7F3A-4EAC-A5A4-3A35A28FE8F0</string>
<string>F7A928F5-B70D-4DB0-8DEF-F61928038A6C</string>

0 comments on commit c6e9f02

Please sign in to comment.