V (よ)う + とする/しない

Usage

V(よ)うに (volitional form) とする / しない.

Indicates a situation arises before doing V, so V does not occur.

It can also indicate that someone is trying to do V

When used としない, it indicates that a person does not intend to do V

Examples

家をでようしたとき、電話がかかってきた。 The phone rang as I was about to leave the house.
雨がやんだので、桜を撮ろうとしたら、カメラの電池が切れてしまった。 When I went to the cherry blossoms photograph because the rain had stopped, I found my camera battery was flat.
父は健康のためにタバコを止めようとしています My father is trying to give up smoking for his health.
人の話を聞こうとしない人は、いつまでたっても自分の考えを変えることができません。 People who are not interested in listening to what others say can never change their opinion.