What command is sent when you click 'set as default printer'?
[/quote]
None. Setting the default printer sets the default printer for the current user on the local machine by calling SetDefaultPrinter() in winspool.drv. It is possible as well to set the default printer using a VBScript.
However, I think the idea you are approaching, which seems to suggest making a short script to change the default printer, run the program, and set it back, has a glaring flaw...
setting the default printer sets it for all applications. So if you run the program more than once, the default printer won't change back. And if you try to do it for multiple programs, you'll have almost no idea where you are really setting it, and the entire thing becomes a game of musical chairs as the printers are randomly shuffled as the default.
The above program does the job by hooking when other programs use the printer and changing the settings before printing. This would probably do what you like. There is the possible issue about what takes precedence when you change options on the printer setup dialog of an application, but for your use case it's capabilities seem to fit the bill.
Program-specific "default" printer settings are program specific. Some programs will allow you to choose a default for that program, others will not.