How can I pass a custom parameter to BatchPlay?

it took me time to wrap my head around but I managed to use it successfully

I think it produces cleaner code.

you basically define a property in options called descriptor it could be an object/array/string/boolean/integer…

executeAsModal(targetFunction, {"commandName": "Disable Snap to Pixels", "descriptor": "any value, any type"});`

function targetFunction(execContext, myString){
    //myString (2nd parameter) always holds the descriptor.
    // output: "any value, any type"
    // you can pass an object that holds multiple properties