I know that a sentence that ends in the て form of a verb can be imperative. How do you know for sure if it is? Why is「～しようとして」not imperative?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
しようとして (and all the forms in ようとして：食べようとして...etc.) can all be perfectly correct requests or commands depending on how the sentence ends.
To understand this, you need to know that the よう form of a verb is called Volitional and is used (in brief) to say "let's do..."
Now, adding として to this volitional form, it should be decomposed as follows:
-と is the particle (same as と言う、と思う)
-して (て form of する)
Then the て form is used to combine sentences (see the Wikipedia article above). ようとして then means "to be about to" or "try to".
The volitional form of a verb + として corresponds to the English "(Please) Try to...". (you can still add ください、ほしい、くれ...etc. like for any other request) It's a very natural way to request someone to do something and see how it goes.
Some widely used examples to illustrate this: