From a script, you can do the following:
/sbin/cardctl scheme AdHoc
where \"AdHoc\" is whatever name you assigned to the adhoc config.
Depending on what language you\'re developing your app in, there is usually a way to shell out & execute commands like the above.