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 & HelpSyntax Questions › publication problem
Page Index Toggle Pages: 1
publication problem (Read 423 times)
publication problem
Dec 25th, 2007, 10:59am
 
hei there! (happy hollidays)!

i've finished a script, that should control iTunes with the sudden motion sensor of a macBook Pro. the sketch runs fine when i start it within processing, but as soon as i export an application it wont work.
has anybody an idea, what the problem could be?

here's the script:

import sms.*;
import com.apple.cocoa.foundation.*;
int num = 60;
int mShock[] = new int[num];

void setup()
{
 size(300, 100);
 smooth();
 noStroke();
 fill(255, 153);
 frameRate(10);
}

void draw()
{
 background(51);
 //sms data
 int[] vals = Unimotion.getSMSArray();
//store in an array
 for(int i=1; i<num; i++) {
   mShock[i-1] = mShock[i];
 }
 mShock[num-1] = vals[0];
 //shock detection
 if((mShock[num-2] > (mShock[num-3]+3)) && (mShock[num-2] > (mShock[num-1]+3)))
 {
   iTunes("playpause");
 }
}
void iTunes(String theCommand) {
 String script = "tell application \"iTunes\""+"\n" + theCommand + "\n" + "end tell";
 executeScript(script);
}
 
void executeScript(String script) {
 NSAppleScript myScript = new NSAppleScript(script);
 NSMutableDictionary errors = new NSMutableDictionary();
 myScript.execute(errors);  
}
Re: publication problem
Reply #1 - Dec 25th, 2007, 2:35pm
 
I do know where to ask this because i don't see any option to start a topic so here its goes, Does processing work with the C++ programming language?
Re: publication problem
Reply #2 - Dec 25th, 2007, 3:12pm
 
you have to navigate to a "board" / "forum" (click on Index in the second row from page-top -> click on the topic title that fits your question best) to start a new thread. the link is in the upper right beige corner "Start new topic".

... and no, processing is based on java not c++.
http://processing.org/faq.html#whyjava

F
Page Index Toggle Pages: 1