Applescript for sorting

What really bugs my about OmniFocus is that it seems impossible to get the following perspective

  1. Sort projects by due
  2. Sort actions within projects by due
    I use ‘Group and sort entire projects’ with ‘sort projects by due,’ but then the actions within the projects are not sorted. I wish Omni gave an option to do that, but meanwhile the only way to obtain that is to use ‘sort once’ to sort actions in projects by due, and then the above perspective.

So, I would like to an applescript to do

  1. Select all projects and all actions with the projects
  2. Use sort once to sort the actions by due
  3. Switch to my perspective with sorted projects.

Anyone can help with that?