Outputting Key Presses

Nov 23, 2007 at 3:58pm

Outputting Key Presses

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?

#34728
Nov 23, 2007 at 4:31pm

[key]

Ryan Tanay wrote:
> 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 key strokes?
>
>

#117641
Nov 23, 2007 at 5:04pm

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

#117642
Nov 24, 2007 at 6:54pm

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.

#117643
Nov 24, 2007 at 6:57pm

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!

#117644
Nov 24, 2007 at 8:31pm

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.

#117645
Nov 24, 2007 at 11:15pm
#117646
Nov 24, 2007 at 11:31pm

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

#117647
Nov 26, 2007 at 7:04pm

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!

#117648
Jun 3, 2008 at 9:39pm

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.

#117649
Jun 4, 2008 at 9:19am

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.

#117650
Jun 4, 2008 at 6:26pm

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?

#117651
Jun 7, 2008 at 5:03pm

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

#117652
Jun 23, 2008 at 5:32pm

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.

#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 479 67 21 196617 t 9;
#P user jit.cellblock 78 131 321 302 3 9 2 15 217 17 0 1 1 0 1 0 1 0 1 255 255 255 50 50 50 0 119 166 0 0 0 50 50 50 255 255 255 112 0 0 1 1 1 0 4 0 0 0;
#X col 0 layout 20 1 107 108 99 1 109 115 116 -1 -1 -1;
#P user dropfile 78 32 321 95 0;
#P newex 422 45 109 196617 sel 50 56 51 57 32;
#P number 534 45 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 422 67 21 196617 t 2;
#P newex 441 67 21 196617 t 8;
#P newex 136 320 29 196617 gate;
#P newex 460 67 21 196617 t 3;
#P newex 422 21 40 196617 key;
#P newex 136 340 51 196617 route set;
#P newex 498 67 29 196617 t 10;
#P newex 136 360 32 196617 print;
#N vpatcher 727 440 1292 772;
#P origin 53 0;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 71 128 76 196617 t 0 i i i b;
#P newex 28 185 27 196617 + 1;
#P newex 431 154 67 196617 r toMatching;
#N counter 0 0;
#X flags 0 0;
#P newobj 261 180 67 196617 counter 0 0;
#N vpatcher 848 301 1354 823;
#P origin 0 -81;
#P inlet 439 72 15 0;
#P inlet 421 72 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 89 116 21 196617 t 1;
#P newex 117 182 41 196617 sel 1 0;
#P newex 179 140 27 196617 ==;
#P newex 160 182 41 196617 sel 1 0;
#P newex 117 140 31 196617 == 0;
#P inlet 319 72 15 0;
#P newex 291 307 32 196617 sel 1;
#P newex 291 281 31 196617 == 0;
#P number 378 281 35 9 0 10 3 3 0 0 0 2 155 246 222 222 222 0 0 0;
#P newex 338 343 40 196617 t 9 b 9;
#N counter 0 10;
#X flags 0 0;
#P newobj 291 255 122 196617 counter 0 10;
#P newex 291 343 40 196617 t 1 b 0;
#P newex 245 398 133 196617 -;
#P newex 338 281 37 196617 == 10;
#P newex 338 307 32 196617 sel 1;
#P outlet 55 464 15 0;
#P inlet 206 72 15 0;
#P message 55 443 97 196617 sync click $1 0 1 1;
#P newex 245 377 27 196617 int;
#P newex 206 94 66 196617 t 1 b i i i;
#P toggle 328 94 15 0;
#P number 55 422 35 9 -1 14 3 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P message 55 401 44 196617 max $1;
#P newex 55 37 67 196617 r toMatching;
#P newex 65 72 30 196617 < = 9;
#P newex 65 94 59 196617 sel 1 0;
#P newex 160 161 29 196617 gate;
#P newex 65 116 21 196617 t 0;
#P toggle 65 140 15 0;
#P newex 291 231 29 196617 gate;
#P newex 117 203 31 196617 t 0 b;
#P newex 160 203 31 196617 t 0 b;
#P connect 8 0 9 0;
#P fasten 19 0 10 0 250 419 60 419;
#P fasten 9 0 10 0 60 419 60 419;
#P connect 10 0 14 0;
#P connect 14 0 16 0;
#P connect 8 0 7 0;
#P connect 7 0 6 0;
#P connect 6 0 4 0;
#P fasten 31 0 3 0 94 137 70 137;
#P connect 4 0 3 0;
#P connect 6 1 31 0;
#P fasten 12 2 27 0 239 127 122 127;
#P connect 27 0 30 0;
#P connect 30 0 1 0;
#P fasten 4 0 5 0 70 137 165 137;
#P fasten 31 0 5 0 94 137 165 137;
#P connect 5 0 28 0;
#P connect 28 0 0 0;
#P fasten 12 3 29 0 253 130 184 130;
#P connect 29 0 5 1;
#P fasten 8 0 29 1 60 57 201 57;
#P connect 15 0 12 0;
#P fasten 20 1 13 0 311 370 250 370;
#P fasten 22 1 13 0 358 373 250 373;
#P connect 13 0 19 0;
#P connect 12 4 13 1;
#P connect 12 0 2 0;
#P fasten 1 0 2 0 122 227 296 227;
#P fasten 0 0 2 0 165 224 296 224;
#P connect 2 0 21 0;
#P connect 21 0 24 0;
#P connect 24 0 25 0;
#P connect 25 0 20 0;
#P fasten 32 0 20 0 426 329 296 329;
#P fasten 1 1 20 0 143 338 296 338;
#P connect 12 1 2 1;
#P connect 26 0 21 1;
#P connect 26 0 11 0;
#P connect 21 0 18 0;
#P connect 18 0 17 0;
#P connect 17 0 22 0;
#P fasten 33 0 22 0 444 332 343 332;
#P fasten 0 1 22 0 186 335 343 335;
#P connect 20 2 19 1;
#P connect 22 2 19 1;
#P fasten 20 0 21 3 296 367 418 367 418 248 380 248;
#P fasten 22 0 21 3 343 364 415 364 415 251 380 251;
#P fasten 21 0 23 0 296 275 383 275;
#P pop;
#P newobj 261 237 99 196617 p matching;
#P newex 28 84 97 196617 foldercoll funfolder;
#N coll funfolder 1;
#P newobj 142 85 79 196617 coll funfolder 1;
#N vpatcher 591 403 1179 699;
#P inlet 16 29 15 0;
#P outlet 16 243 15 0;
#P button 309 122 15 0;
#P window setfont “Sans Serif” 9.;
#P newex 96 143 29 196617 t 10;
#P newex 196 112 84 196617 split 100 10000;
#P newex 140 93 66 196617 split 10 100;
#P newex 196 143 29 196617 t 30;
#P newex 16 192 71 196617 prepend rows;
#P message 46 214 78 196617 refer funfolder;
#P message 96 172 75 196617 col 0 width $1;
#P newex 140 143 29 196617 t 20;
#P newex 270 143 29 196617 t 40;
#P button 328 122 15 0;
#P button 346 122 15 0;
#P button 365 122 15 0;
#P newex 96 74 54 196617 split 0 10;
#P newex 16 50 40 196617 t i i b;
#P connect 16 0 0 0;
#P connect 0 0 9 0;
#P fasten 7 0 15 0 101 236 21 236;
#P fasten 8 0 15 0 51 236 21 236;
#P connect 9 0 15 0;
#P connect 0 2 8 0;
#P fasten 0 1 1 0 36 70 101 70;
#P fasten 14 0 13 0 314 140 101 140;
#P connect 1 0 13 0;
#P fasten 13 0 7 0 101 166 101 166;
#P fasten 5 0 7 0 275 166 101 166;
#P fasten 10 0 7 0 201 166 101 166;
#P fasten 6 0 7 0 145 166 101 166;
#P connect 1 1 11 0;
#P connect 11 0 6 0;
#P fasten 4 0 6 0 333 140 145 140;
#P connect 11 1 12 0;
#P connect 12 0 10 0;
#P fasten 3 0 10 0 351 140 201 140;
#P connect 12 1 5 0;
#P fasten 2 0 5 0 370 140 275 140;
#P pop;
#P newobj 28 206 106 196617 p populate_cell_block;
#P message 37 237 31 196617 1 $1;
#P message 135 237 55 196617 select 1 0;
#P newex 261 205 23 196617 t i i;
#P number 431 206 35 9 0 14 3 3 0 0 0 108 196 2 222 222 222 0 0 0;
#P newex 119 154 67 196617 s toMatching;
#P newex 71 106 27 196617 – 1;
#P message 47 58 40 196617 sounds;
#P message 431 175 44 196617 max $1;
#N vpatcher 710 357 1411 657;
#P origin 0 21;
#P outlet 434 228 15 0;
#P window setfont “Sans Serif” 9.;
#P message 406 150 70 196617 rgb5 112 0 0;
#P message 448 183 76 196617 rgb5 240 22 0;
#P outlet 406 228 15 0;
#P newex 392 98 66 196617 t 0 b b 1 b;
#P newex 406 127 55 196617 delay 100;
#P outlet 193 228 15 0;
#P newex 233 189 40 196617 t b 0 0;
#P newex 193 51 214 196617 sel 2 8 3 9 10;
#P newex 193 189 39 196617 t b 1 1;
#P outlet 277 228 15 0;
#P outlet 298 228 15 0;
#P outlet 235 228 15 0;
#P outlet 256 228 15 0;
#P inlet 371 0 15 0;
#P outlet 214 228 15 0;
#P newex 136 103 32 196617 sel 1;
#P newex 294 153 23 196617 int;
#P newex 294 105 29 196617 gate;
#P newex 307 132 23 196617 + 9;
#P newex 337 189 53 196617 t b i 0 0;
#P newex 48 75 21 196617 t 1;
#P newex 24 26 30 196617 < = 9;
#P newex 24 51 41 196617 sel 1 0;
#P newex 254 105 29 196617 gate;
#P newex 24 75 21 196617 t 0;
#P toggle 24 107 15 0;
#P newex 267 132 23 196617 – 9;
#P newex 277 189 53 196617 t b i 1 1;
#P newex 24 1 67 196617 r toMatching;
#P newex 254 153 23 196617 int;
#P newex 98 75 30 196617 < = 9;
#P newex 98 103 32 196617 sel 1;
#P newex 98 123 21 196617 t 0;
#P newex 153 51 27 196617 – 9;
#P newex 136 75 27 196617 >=;
#P newex 136 123 55 196617 int;
#P inlet 193 0 15 0;
#P connect 8 0 15 0;
#P connect 15 0 14 0;
#P connect 14 0 12 0;
#P fasten 16 0 11 0 53 99 29 99;
#P lcolor 4;
#P fasten 12 0 11 0 29 100 29 100;
#P lcolor 4;
#P connect 14 1 16 0;
#P fasten 23 0 6 0 376 45 103 45;
#P lcolor 6;
#P connect 6 0 5 0;
#P connect 5 0 4 0;
#P fasten 23 0 2 0 376 45 141 45;
#P lcolor 6;
#P connect 2 0 21 0;
#P connect 21 0 1 0;
#P fasten 8 0 3 0 29 21 158 21;
#P connect 3 0 2 1;
#P fasten 8 0 1 1 29 21 186 21;
#P connect 0 0 29 0;
#P connect 29 0 28 0;
#P lcolor 1;
#P fasten 28 0 31 0 198 212 198 212;
#P lcolor 7;
#P fasten 30 0 31 0 238 212 198 212;
#P lcolor 7;
#P fasten 9 2 22 0 310 215 219 215;
#P lcolor 4;
#P fasten 17 2 22 0 370 215 219 215;
#P lcolor 4;
#P fasten 30 1 22 0 253 215 219 215;
#P lcolor 4;
#P fasten 28 1 22 0 212 215 219 215;
#P lcolor 4;
#P fasten 29 1 30 0 238 173 238 173;
#P lcolor 1;
#P fasten 9 1 25 0 296 218 240 218;
#P lcolor 1;
#P fasten 17 1 25 0 356 218 240 218;
#P lcolor 1;
#P fasten 16 0 13 0 53 99 259 99;
#P lcolor 4;
#P fasten 12 0 13 0 29 99 259 99;
#P lcolor 4;
#P connect 13 0 7 0;
#P fasten 9 3 24 0 324 221 261 221;
#P lcolor 10;
#P fasten 17 3 24 0 384 221 261 221;
#P lcolor 10;
#P fasten 28 2 24 0 226 221 261 221;
#P lcolor 10;
#P fasten 30 2 24 0 268 221 261 221;
#P lcolor 10;
#P fasten 23 0 10 0 376 73 272 73;
#P lcolor 6;
#P fasten 4 0 7 1 103 151 272 151;
#P connect 10 0 7 1;
#P connect 29 2 13 1;
#P lcolor 1;
#P connect 7 0 9 0;
#P fasten 9 0 27 0 282 224 282 224;
#P fasten 16 0 19 0 53 99 299 99;
#P lcolor 4;
#P fasten 12 0 19 0 29 99 299 99;
#P lcolor 4;
#P connect 19 0 20 0;
#P fasten 17 0 26 0 342 224 303 224;
#P fasten 23 0 18 0 376 73 312 73;
#P lcolor 6;
#P fasten 1 0 20 1 141 151 312 151;
#P connect 18 0 20 1;
#P connect 29 3 19 1;
#P lcolor 1;
#P connect 20 0 17 0;
#P connect 29 4 33 0;
#P connect 33 1 32 0;
#P connect 32 0 36 0;
#P fasten 33 2 34 0 425 218 411 218;
#P lcolor 12;
#P connect 36 0 34 0;
#P lcolor 12;
#P fasten 35 0 34 0 453 218 411 218;
#P lcolor 12;
#P fasten 33 0 37 0 397 222 439 222;
#P lcolor 5;
#P connect 33 3 37 0;
#P lcolor 5;
#P connect 33 4 35 0;
#P pop;
#P newobj 261 154 161 196617 p 2and8and3and9;
#P newex 47 36 48 196617 loadbang;
#P outlet 408 268 15 0;
#P inlet 261 36 15 0;
#P outlet 261 268 15 0;
#P outlet 28 268 15 0;
#P inlet 28 36 15 0;
#P connect 0 0 17 0;
#P fasten 8 0 17 0 52 78 33 78;
#P connect 22 2 21 0;
#P connect 21 0 15 0;
#P fasten 6 6 1 0 392 228 33 228;
#P fasten 13 0 1 0 140 260 33 260;
#P fasten 14 0 1 0 42 260 33 260;
#P connect 15 0 1 0;
#P fasten 12 1 14 0 279 231 42 231;
#P connect 5 0 8 0;
#P connect 17 1 9 0;
#P connect 9 0 22 0;
#P connect 22 3 10 0;
#P connect 22 4 13 0;
#P connect 3 0 6 0;
#P connect 6 0 19 0;
#P connect 19 0 12 0;
#P connect 12 0 18 0;
#P connect 18 0 2 0;
#P connect 6 1 19 1;
#P lcolor 4;
#P fasten 6 3 18 1 329 216 295 216;
#P lcolor 10;
#P fasten 22 0 19 3 76 177 308 177;
#P connect 6 2 19 3;
#P fasten 22 1 19 4 92 174 322 174;
#P fasten 6 4 18 2 350 219 324 219;
#P fasten 6 5 18 3 371 222 353 222;
#P connect 6 7 4 0;
#P fasten 11 0 6 1 436 226 425 226 425 141 417 141;
#P connect 20 0 7 0;
#P fasten 19 0 11 0 266 201 436 201;
#P lcolor 15;
#P fasten 7 0 11 0 436 194 436 194;
#P pop;
#P newobj 78 100 256 196617 p junk;
#P connect 4 0 10 0;
#P fasten 4 0 9 0 427 41 539 41;
#P fasten 0 2 6 0 329 314 141 314;
#P fasten 0 1 12 1 206 124 316 124;
#P connect 0 0 12 0;
#P fasten 2 0 0 1 503 92 329 92;
#P fasten 13 0 0 1 484 92 329 92;
#P fasten 5 0 0 1 465 92 329 92;
#P fasten 7 0 0 1 446 92 329 92;
#P fasten 8 0 0 1 427 92 329 92;
#P connect 11 0 0 0;
#P connect 10 4 2 0;
#P connect 10 3 13 0;
#P connect 10 2 5 0;
#P connect 10 1 7 0;
#P connect 10 0 8 0;
#P connect 12 1 6 1;
#P connect 3 0 1 0;
#P connect 6 0 3 0;
#P window clipboard copycount 14;

#117653
Jun 24, 2008 at 6:08am

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

#117654

You must be logged in to reply to this topic.