Not sure if you can do it with the pet functions, but a modifier macro might work, either that or you'll just need 2 macros. Cause the way the commands you have posted would work is to instantly put in both commands at the same time, thus turning it off, then immediately back on.
Yeah as mentioned in Flaim's link, you need to specify a skill to turn autocast on and off for. Can't just globally turn them all on or off (nor can I imagine a situation where you'd want to do that anyway). And also mentioned there, /petautocasttoggle is probably what you should be using.