Can mxj watch a patcher for arbitrary events?

Nov 29, 2006 at 1:49am

Can mxj watch a patcher for arbitrary events?

Hello all,

I’m trying to write an mxj kinda-alternative to autopattr and company. I want to interface max UI stuff with JMSL (algomusic.com) to record presets and play back my actions.

I REALLY want to do this without wires. I can easily send messages to arbitrary MaxBoxes, but I can’t seem to figure out how to make java respond when I click (for instance) a bangbutton that isn’t wired to the mxj.

Any ideas? I tried implementing MessageReceiver but it seems that it only receives events from AudioBuffer.

best,
Kevin

#28947
Dec 2, 2006 at 6:02pm

No ideas? Topher (I think you’re the most qualified!)?

-kevin

#89435
Dec 6, 2006 at 8:38pm

Hi Kevin,

>From within some Java code I can’t think of any way to get at the
message (register a callback, or something like that) that a lonely,
unconnected bang button sends out.

Sorry,
Ben

On 11/28/06, Kevin Cox wrote:
>
> Hello all,
>
> I’m trying to write an mxj kinda-alternative to autopattr and company. I want to interface max UI stuff with JMSL (algomusic.com) to record presets and play back my actions.
>
> I REALLY want to do this without wires. I can easily send messages to arbitrary MaxBoxes, but I can’t seem to figure out how to make java respond when I click (for instance) a bangbutton that isn’t wired to the mxj.
>
> Any ideas? I tried implementing MessageReceiver but it seems that it only receives events from AudioBuffer.
>
> best,
> Kevin
>

#89436
Jan 13, 2007 at 12:26pm

Quote: Kevin Cox wrote on Wed, 29 November 2006 02:49
—————————————————-
> Hello all,
>
> I’m trying to write an mxj kinda-alternative to autopattr and company. I want to interface max UI stuff with JMSL (algomusic.com) to record presets and play back my actions.
>
> I REALLY want to do this without wires. I can easily send messages to arbitrary MaxBoxes, but I can’t seem to figure out how to make java respond when I click (for instance) a bangbutton that isn’t wired to the mxj.
>
> Any ideas? I tried implementing MessageReceiver but it seems that it only receives events from AudioBuffer.
>
> best,
> Kevin
—————————————————-

I have the same problem in javascript. The way I do this now is to put a pattr outside the js (in your case mxj) object, reserve a special inlet for it, bind it to the pattr where your input enters the patch. You know about the existence of pattrmarker? That one makes this more easy to bind to a remote place.

Oh and make sure you have the latest incremental download of pattr. The default one doesn’t update if its bound counterpart updates.

Hth,
Mattijs

#89437
Jan 13, 2007 at 2:08pm

(wow, email notification is great! would’ve definitely missed this…)

Thanks for the info, Mattijs! I’m not completely sure of what you mean, and I don’t have time to mess around in Max (on holiday skiing – opened the computer to check the online ski report).

do you mean

[pattr]
|
[mxj or js MyThing]

within a patcher?

Could you maybe paste an example?

thanks VERY much – this was great timing, by the way – I’m about to have a lot more time to Max.

#89438
Jan 13, 2007 at 2:31pm

Oh.

I thought about this a bit more. The pattr wouldn’t be wired to the mxj/js.

I don’t know about pattrmarker. I feel like I’ve heard of it but I just did a quick search and didn’t turn up anything obvious.

time to suit up!

#89439
Jan 13, 2007 at 4:32pm

Quote: Kevin Cox wrote on Sat, 13 January 2007 15:08
—————————————————-
> (wow, email notification is great! would’ve definitely missed this…)
>
> Thanks for the info, Mattijs! I’m not completely sure of what you mean, and I don’t have time to mess around in Max (on holiday skiing – opened the computer to check the online ski report).
>
> do you mean
>
> [pattr]
> |
> [mxj or js MyThing]
>
> within a patcher?

That’s right.

>
> Could you maybe paste an example?

Sure. I attached it.

Mattijs

#89440
Jan 16, 2007 at 12:43am

Is it possible to use either Java or JavaScript to copy a string from
Max to the clipboard (Mac OS X and Windows XP)?

Georg

#89441
Jan 16, 2007 at 1:23am

Hi Georg,

You can do it with Java:

http://www.javapractices.com/Topic82.cjp


Owen

Georg Hajdu wrote:
> Is it possible to use either Java or JavaScript to copy a string from
> Max to the clipboard (Mac OS X and Windows XP)?
>
> Georg
>

#89442
Jan 16, 2007 at 7:35am

Hi Owen,

Thank you for the hint.

Georg

On Jan 16, 2007, at 2:23 AM, Owen Green wrote:

> Hi Georg,
>
> You can do it with Java:
> http://www.javapractices.com/Topic82.cjp
>
> —
> Owen
>
> Georg Hajdu wrote:
>> Is it possible to use either Java or JavaScript to copy a string
>> from Max to the clipboard (Mac OS X and Windows XP)?
>> Georg
>

#89443
Jan 16, 2007 at 5:17pm

Hi Owen,

Do you have an idea how to implement this code in mxj? I failed
miserably, which is probably due to the fact that I’m far from being
a Java, let alone MaxJava expert.

Thank you,

Georg

On Jan 16, 2007, at 2:23 AM, Owen Green wrote:

> Hi Georg,
>
> You can do it with Java:
> http://www.javapractices.com/Topic82.cjp
>
> —
> Owen
>
> Georg Hajdu wrote:
>> Is it possible to use either Java or JavaScript to copy a string
>> from Max to the clipboard (Mac OS X and Windows XP)?
>> Georg
>

#89444
Jan 16, 2007 at 7:46pm

this should be close if you just want to copy To the system clipboard.
topher

import java.awt.datatransfer.Clipboard;
import java.awt.datatransfer.ClipboardOwner;
import java.awt.datatransfer.Transferable;
import java.awt.datatransfer.StringSelection;
import java.awt.Toolkit;
import java.io.*;

public class toclipboard extends MaxObject implements ClipboardOwner
{

public void setClipboardContents( String aString ){
StringSelection stringSelection = new StringSelection( aString );
Clipboard clipboard = Toolkit.getDefaultToolkit
().getSystemClipboard();
clipboard.setContents( stringSelection, this );
}

/**
* Empty implementation of the ClipboardOwner interface.
*/
public void lostOwnership( Clipboard aClipboard, Transferable
aContents) {
//do nothing
}
}

On Jan 16, 2007, at 09:17 AM, Georg Hajdu wrote:

> Hi Owen,
>
> Do you have an idea how to implement this code in mxj? I failed
> miserably, which is probably due to the fact that I’m far from
> being a Java, let alone MaxJava expert.
>
> Thank you,
>
> Georg
>
> On Jan 16, 2007, at 2:23 AM, Owen Green wrote:
>
>> Hi Georg,
>>
>> You can do it with Java:
>> http://www.javapractices.com/Topic82.cjp
>>
>> —
>> Owen
>>
>> Georg Hajdu wrote:
>>> Is it possible to use either Java or JavaScript to copy a string
>>> from Max to the clipboard (Mac OS X and Windows XP)?
>>> Georg
>>
>

#89445
Jan 16, 2007 at 8:17pm

On 16 janv. 07, at 18:17, Georg Hajdu wrote:

> Hi Owen,
>
> Do you have an idea how to implement this code in mxj? I failed
> miserably, which is probably due to the fact that I’m far from
> being a Java, let alone MaxJava expert.

This is quickly made, but should give you enough information to start
with.

Best,
ej

#89446
Jan 16, 2007 at 9:37pm

Aww, I just made one and in the meantime Topher and Emmanuel beat me to it!

Anyway, just for completeness; put the attached jar file somewhere
useful and hack the source to your heart’s content.

#P window setfont “Sans Serif” 10.;
#P window linecount 1;
#P comment 120 133 322 196618 Use paste to spit clipboard contents (if
it’s a string) from outlet;
#P comment 120 102 195 196618 Quote strings with whitespace in them;
#P message 13 71 59 196618 copy hello;
#P window linecount 0;
#P message 13 256 17 196618;
#P window linecount 1;
#P message 13 133 35 196618 paste;
#P newex 13 224 66 196618 prepend set;
#P message 13 102 100 196618 copy “hello world”;
#P newex 13 185 162 196618 mxj otg.max.util.ClipboardText;
#P window setfont “Sans Serif” 18.;
#P comment 11 31 209 196626 MXJ Clipboard Example;
#P window setfont “Sans Serif” 10.;
#P comment 120 71 183 196618 Use copy to load text on to clipboard;
#P hidden connect 3 0 2 0;
#P hidden connect 5 0 2 0;
#P hidden connect 7 0 2 0;
#P connect 2 0 4 0;
#P connect 4 0 6 0;
#P window clipboard copycount 10;

Georg Hajdu wrote:
> Do you have an idea how to implement this code in mxj? I failed
> miserably, which is probably due to the fact that I’m far from being a
> Java, let alone MaxJava expert.

#89447
Jan 17, 2007 at 12:01am

Thanks Topher,

Your solution works like a charm! Finally, I get to put my Max chat
stuff on the clipboard.
What about inclusion in Max v5?

Best,

Georg

On Jan 16, 2007, at 8:46 PM, topher lafata wrote:

> this should be close if you just want to copy To the system clipboard.
> topher
>
>
> import java.awt.datatransfer.Clipboard;
> import java.awt.datatransfer.ClipboardOwner;
> import java.awt.datatransfer.Transferable;
> import java.awt.datatransfer.StringSelection;
> import java.awt.Toolkit;
> import java.io.*;
>
> public class toclipboard extends MaxObject implements ClipboardOwner
> {
>
> public void setClipboardContents( String aString ){
> StringSelection stringSelection = new StringSelection( aString );
> Clipboard clipboard = Toolkit.getDefaultToolkit
> ().getSystemClipboard();
> clipboard.setContents( stringSelection, this );
> }
>
> /**
> * Empty implementation of the ClipboardOwner interface.
> */
> public void lostOwnership( Clipboard aClipboard, Transferable
> aContents) {
> //do nothing
> }
> }
>
> On Jan 16, 2007, at 09:17 AM, Georg Hajdu wrote:
>
>> Hi Owen,
>>
>> Do you have an idea how to implement this code in mxj? I failed
>> miserably, which is probably due to the fact that I’m far from
>> being a Java, let alone MaxJava expert.
>>
>> Thank you,
>>
>> Georg
>>
>> On Jan 16, 2007, at 2:23 AM, Owen Green wrote:
>>
>>> Hi Georg,
>>>
>>> You can do it with Java:
>>> http://www.javapractices.com/Topic82.cjp
>>>
>>> —
>>> Owen
>>>
>>> Georg Hajdu wrote:
>>>> Is it possible to use either Java or JavaScript to copy a string
>>>> from Max to the clipboard (Mac OS X and Windows XP)?
>>>> Georg
>>>
>>
>

#89448
Jan 17, 2007 at 6:18am

Hi Emmanuel

Thank you. For some reason, your solution won’t instantiate on my
computer.

Best,

Georg

On Jan 16, 2007, at 9:17 PM, Emmanuel Jourdan wrote:

> On 16 janv. 07, at 18:17, Georg Hajdu wrote:
>
>> Hi Owen,
>>
>> Do you have an idea how to implement this code in mxj? I failed
>> miserably, which is probably due to the fact that I’m far from
>> being a Java, let alone MaxJava expert.
>
> This is quickly made, but should give you enough information to
> start with.
>
> Best,
> ej
>
>
>

#89449
Jan 17, 2007 at 6:26am

Thanks to you too! It works.

Regards,

Georg

On Jan 16, 2007, at 10:37 PM, Owen Green wrote:

> #P window setfont “Sans Serif” 10.;
> #P window linecount 1;
> #P comment 120 133 322 196618 Use paste to spit clipboard contents
> (if it’s a string) from outlet;
> #P comment 120 102 195 196618 Quote strings with whitespace in them;
> #P message 13 71 59 196618 copy hello;
> #P window linecount 0;
> #P message 13 256 17 196618;
> #P window linecount 1;
> #P message 13 133 35 196618 paste;
> #P newex 13 224 66 196618 prepend set;
> #P message 13 102 100 196618 copy “hello world”;
> #P newex 13 185 162 196618 mxj otg.max.util.ClipboardText;
> #P window setfont “Sans Serif” 18.;
> #P comment 11 31 209 196626 MXJ Clipboard Example;
> #P window setfont “Sans Serif” 10.;
> #P comment 120 71 183 196618 Use copy to load text on to clipboard;
> #P hidden connect 3 0 2 0;
> #P hidden connect 5 0 2 0;
> #P hidden connect 7 0 2 0;
> #P connect 2 0 4 0;
> #P connect 4 0 6 0;
> #P window clipboard copycount 10;

#89450
Jan 17, 2007 at 7:47am

#89451
Jan 17, 2007 at 5:18pm

#89452
Jan 17, 2007 at 6:32pm

#89453
Mar 15, 2012 at 3:24pm

hello to all.

anybody know where i can get the jar file mentioned here? …seems to have been removed from this decrepit thread.

much thanks.

#89454

You must be logged in to reply to this topic.