Programmatically Set Default Text Editor
Below code is used in wysiwyg_profile_form_submit() at wysiwyg.admin.inc. You can make use of it.

// Insert new profile data.
db_merge('wysiwyg')
  -&gt;key(array('format' =&gt; $format))
  -&gt;fields(array(
    'editor' =&gt; $editor,
    'settings' =&gt; serialize($values),
  ))
  -&gt;execute();
wysiwyg_profile_cache_clear();


Another approach is using drupal_form_submit() to submit its settings form programmatically. But it would be more compliated.

Also, before settings the profile, you need to check if tinymce is existing.

if (wysiwyg_get_editor('tinymce')) {

  // set profile.

}