Outputting Key Presses

NewEvolution's icon

Hey all. As is somehow usually the case, I'm trying to do something deceptively simple in Max, and hitting a brick wall.

What I need my patch to do is output a keystroke every second. I want to use the patch in the background to send keystrokes to another program.

What I'm essentially looking for is a "ghost typer" effect, where Max would be able to type text into a document open in TextEdit or what-have you. Using [metro] is a given, I just can't find what to send it to in order to output a keystroke. Searching the forums and documentation hasn't helped, so it's time to ask outright.

Are there any Max objects that can produce keystrokes?

Stefan Tiedje's icon

eva sjuve schrieb:
> [key]

key is for receiving key strokes and would also only work if Max is in
the active...

> Ryan Tanay wrote:
>> What I need my patch to do is output a keystroke every second. I want
>> to use the patch in the background to send keystrokes to another program.

It seems you're on a a mac. The only way I can imagine is applescript.
Probably only if its supported by the program...
There is an applescript external in the Taptools...

Stefan

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com

NewEvolution's icon

Quote: Stefan Tiedje wrote on Fri, 23 November 2007 12:04
----------------------------------------------------
> key is for receiving key strokes and would also only work if Max is in
> the active...
----------------------------------------------------

Exactly. I need basically the opposite of [key]. Something that will take an int ASCII value as an argument and output a keystroke on bang. And when I say keystroke, I don't mean output simply the letter symbol, [itoa] already does that. I need a keystroke so that Max can type into another program.

NewEvolution's icon

Quote: Stefan Tiedje wrote on Fri, 23 November 2007 12:04
----------------------------------------------------
> It seems you're on a a mac. The only way I can imagine is applescript.
> Probably only if its supported by the program...
> There is an applescript external in the Taptools...
>
> Stefan
----------------------------------------------------

Somehow missed this part = I'll try poking around in AppleScript and see if that does the trick, thanks!

benj3737's icon

Have you looked at MIDIstroke?
http://www.charlie-roberts.com/midiStroke/

It's not as nice as having everything integrated into MAX, but it might work for you.

davydka's icon
MikEyhaTsis's icon

On a Mac you can use either of the externals [shell] or [aka.shell] to send out applecript ( osascript ) commands. ive had better luck with aka.shell. You an get it at:
http://www.iamas.ac.jp/~aka/max/

theres about 250ms of latency from the bang to the applescript command taking affect in the target app, don't know if it will interfere with what your doing.

Peace

NewEvolution's icon

Thanks for all the great advice. I picked up Tap.Tools as it does a lot of other things I'm looking for as well.

The latency issue in aka.shell isn't an issue, so long as the latency is constant. It's the spacing between the commands that are important, more than their synchronization with whatever Max is doing.

Between everything posted here, I'm sure I'll get at least on method to do what I need. Thanks again!

Nathan Bowen's icon

Along these lines, I have a similar issue with trying to output keypresses using the opendialog object. To illustrate the issue, I'm trying to send through a LAN network some keypress info. One of those keypresses bangs [opendialog], but after that I can't navigate within that dialog box.

I'm on a Mac, and the aka.keyboard would theoretically do exactly what I'm wanting if I knew the right mode to use synthetically. It doesn't work once the dialog box occurs, as far as I can tell.

Does anyone have an idea how to navigate the dialog without keyboard presses, but with integers coming in through Max?

Thanks in advance.

grg's icon

Am 03.06.2008 um 23:39 schrieb nb23:
> Does anyone have an idea how to navigate the dialog without keyboard
> presses, but with integers coming in through Max?

Use ubumenu instead of opendialog?

Cheers, g.

Nathan Bowen's icon

From a practical standpoint, the ubumenu would do the trick, but now I'm curious about how to make Max execute Finder commands, and I'm wondering how to ensure that Max commands not be overridden when the dialog box occurs.

I guess what I'm really after is for there to be a way to navigate between folders without the mouse, via a different computer on a LAN. The depth feature for the ubumenu is okay, but really not what I'm wanting.

I can live with the ubumenu if need be... Can I view the entire ubumenu contents without using a mousedown?

Stefan Tiedje's icon

nb23 schrieb:
> I can live with the ubumenu if need be... Can I view the entire
> ubumenu contents without using a mousedown?

I made a little abhaXion called foldercoll to fill a coll in parallel
with a menu, that coll could be displayed with jit.cellblock...

You could also create your own navigation with the folder object and
some regexp...

Stefan

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com

Nathan Bowen's icon

Thanks for your suggestion with Foldercoll, Stefan! I think I'm going to go with it. I've pasted what I've done below. I feel it's a little inefficient, but it seems solid for what I'm trying to do. I'd welcome any feedback.

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

Stefan Tiedje's icon

nb23 schrieb:
> I feel it's a little inefficient, but it seems solid for what I'm
> trying to do. I'd welcome any feedback.

Solid is never inefficient...
I'd place the dropfile above the jit.cellblock, as this is the place you
see filling up when dropping, seems more intuitive...
You could replace the sel/t construction with a coll saved within the
patcher...

Stefan

--
Stefan Tiedje------------x-------
--_____-----------|--------------
--(_|_ ----|-----|-----()-------
-- _|_)----|-----()--------------
----------()--------www.ccmix.com