We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Processing + Textmate
Pages: 1 2 
Processing + Textmate (Read 11369 times)
Processing + Textmate
Mar 20th, 2007, 3:08pm
 
anyone tried to make a Processing bundle for textmate?

If not could anyone point me in the right direction for things like compiling a Processing sketch from the MacOS X Terminal and such.
Re: Processing + Textmate
Reply #1 - Mar 21st, 2007, 5:57pm
 
Hi James-

I just use the TextMate Java bundle, since Processing code is Java.  A few Processing-defined types (like "color") don't get highlighted, but it hasn't bothered me enough to dive into the bundle and make changes.

For compiling, running and exporting applets and applications, I just keep the PDE running and I swap over to it.  This takes advantage of all the goodies built into the PDE while I get to edit in TextMate.  I've found it helpful to use the "Use external editor" checkbox in the preferences to avoid accidentally overwriting anything while using the PDE.

If you want to streamline things further, you should probably take a look at some of the other threads around here from people using Eclipse.  You will probably run into some of the same issues they have had.

-Matt
Re: Processing + Textmate
Reply #2 - Mar 29th, 2007, 2:26pm
 
There is a processing bundle available through the GetBundle bundle which makes formatting and coloring a lot nicer.

Unfortunately I have been unable to get it to link back to the Processing app when i wish to compile and run my PDE file. I was also unable to get the use external editor feature in processing to work.

Any advice on how to go about either of these things would be nice, I miss TextMate.

Andrew
Re: Processing + Textmate
Reply #3 - Mar 29th, 2007, 2:39pm
 
I can't believe I missed that, I was sure I checked.

Next time I'm doing some Processing I'll have to write a few more snippets and stuff for it!

Cheers dunkster
Re: Processing + Textmate
Reply #4 - Mar 29th, 2007, 2:48pm
 
No probs, If you get the 'Run in Processing' command to work let me know.

Andrew
Re: Processing + Textmate
Reply #5 - May 2nd, 2007, 5:31pm
 
in the Bundle editor replace the command "Run in Processing" by this :
-----
content () {
   iconv -cs -f utf-8 -t macroman//TRANSLIT | perl -pe 's/["\\]/\\$&/g'
}

osascript <<-APPLESCRIPT
tell application "Processing 0124" to activate
set the clipboard to "$(content)"
tell application "System Events" to tell process "Processing"
   keystroke "a" using command down
   keystroke "v" using command down
   delay 0.3
   keystroke "r" using command down
end tell
APPLESCRIPT
------
Re: Processing + Textmate
Reply #6 - May 2nd, 2007, 5:32pm
 
oups with the "Entire Document" selected in "Input"
Re: Processing + Textmate
Reply #7 - Sep 11th, 2007, 8:00pm
 
Hello,

the above didn't work for me. Especially when it came to Processing projects requiring support files (font, images, etc.) the copy/paste approach fails since those files will be missing when running the project. Instead, I use these settings for the "Run in Processing" command.

Save: Current File

Command(s):
osascript <<EOF
tell application "Processing 0125" to run
tell application "Processing 0125" to activate
tell application "Processing 0125" to open POSIX file "${TM_FILEPATH}"
delay 1
tell application "System Events" to tell process "Processing"

keystroke "r" using command down
end tell
EOF

Input: None
Output: Discard

Best regards
 lsinger
Re: Processing + Textmate
Reply #8 - Dec 8th, 2007, 10:50pm
 
Hey folks, thanks for the tip.

I am using the following run command:

Code:

osascript -e 'tell application "Processing 0125" to activate' -e 'tell application "System Events" to tell process "Processing"' -e 'keystroke "r" using command down' -e 'end tell'


Requires having the project open in processing, but allows multiple file projects to work.
Re: Processing + Textmate
Reply #9 - Apr 25th, 2008, 12:07pm
 
Can anyone get textmate to open sketches in processing? - I've tried a few scripts that available and none have worked so far. I'm on leopard.
Re: Processing + Textmate
Reply #10 - Apr 26th, 2008, 9:01pm
 
processing should respond to a standard 'open document' appleevent (make sure you're using a more recent version than 0125 like the previous old posts). is that not working?
Re: Processing + Textmate
Reply #11 - Apr 27th, 2008, 3:25pm
 
Thanks and apologies for copying and pasting the code without noticing I had to change the version number. It works fine.
Re: Processing + Textmate
Reply #12 - May 19th, 2008, 1:32am
 
Hi there, gosh, why not genericize the script a bit, unless you take pleasure in changing your script often? I've submitted the following as a patch as well.

osascript <<EOF
tell application "Processing" to run
tell application "Processing" to activate
tell application "Processing" to open POSIX file "${TM_FILEPATH}"
delay 1
tell application "System Events" to tell process "Processing"

keystroke "r" using command down
end tell
EOF
Re: Processing + Textmate
Reply #13 - Jun 17th, 2008, 3:37am
 
Thanks to everybody!

I made a small script to get the documentation for the current word. Just include a variable named TM_PROCESSING_DOC in Textmate > Advanced > Shell Variables that points to your processing documentation.

Then in the bundle editor, under the Processing bundle, make a new command and copy the script.

For the output I used "Show as Tool tip" and for the activation I've chosen Key Equivalent: ^H

#!/usr/bin/python
import os
import webbrowser
from os import path

### DEFINITIONS
def viewdoc(filename):
 if path.exists(filename) and path.isfile(filename):
   webbrowser.open(filename)
 else:
   print "Word not found or TM_PROCESSING_DOC not set properly."

### BEGIN SCRIPT
reference = os.environ['TM_PROCESSING_DOC']
word = os.environ['TM_CURRENT_WORD']

if reference.endswith("/"):
 pass
else:
 reference = os.environ['TM_PROCESSING_DOC'] + "/"

viewdoc(reference + word + "_.html")
Re: Processing + Textmate
Reply #14 - Aug 13th, 2009, 8:38pm
 
first post! yahoo.

The script by Yong Bakos worked for me, but only after I changed "Processing" to "Processing.app" in the script window in TextMate.

Thanks everybody.
-a
Pages: 1 2