Can mxj watch a patcher for arbitrary events?

Kevin Cox's icon

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

Kevin Cox's icon

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

-kevin

projects's icon

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
>

Mattijs's icon

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

Kevin Cox's icon

(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.

Kevin Cox's icon

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!

Mattijs's icon

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

Georg Hajdu's icon

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

Owen Green's icon

Hi Georg,

--
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
>

Georg Hajdu's icon

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
>

Georg Hajdu's icon

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
>

topher lafata's icon

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
>>
>

Emmanuel Jourdan's icon

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

Owen Green's icon

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.

Max Patch
Copy patch and select New From Clipboard in Max.

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.

Georg Hajdu's icon

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
>>>
>>
>

Georg Hajdu's icon

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
>
>
>

Georg Hajdu's icon

Thanks to you too! It works.

Regards,

Georg

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

Max Patch
Copy patch and select New From Clipboard in Max.

>

Georg Hajdu's icon
Emmanuel Jourdan's icon
jonHuntsman's icon

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.