Script to delete objects based on x position

jmmmp's icon

Hi list,

I'm trying to prepare a script that delete certain types of objects in a subpatch, based on their types and also on the x position, declared by the message "del x". This script already worked before to delete all objects in the canvas, but I can't seem to make the > x condition work.
Can anyone have a look to see what I'm doing wrong?

Here is the patch and script:

test.maxpat
text/plain 8.37 KB

delete-objects.js
application/x-javascript 0.51 KB

Thanks,
jmmmp

11OLSEN's icon

why do you think obj.jsarguments[1] holds the position of an object?

jmmmp's icon

Because I don't know anything about javascript.
How does that question help to get a solution?

11OLSEN's icon

The question points to the error in your script. Try replacing that with obj.rect[0]

Roman Thilenius's icon

are you guys going to build an eraser tool for the patching canvas?

jmmmp's icon

Exactly, for certain types of objects. Thanks, it works like this.