[verb (volitional)] + としたが、[sentence] [verb (volitional)] + としたけど、[sentence]
としたが means "tried to…, but" or "was about to…, but": the action was attempted or about to start, and something stopped it. It follows the volitional form of a verb – あけよう開けよう, いこう行こう, しよう – and the clause after が says what went wrong.
The verb must be volitional: ×開けるとしたが, ×開けたとしたが.
てみたが means you did the thing and the result disappointed you. としたが means you never got to do it, or did not manage it.
These go beyond the basic "tried to, but".
が is the written and careful form. In conversation the same sentence takes けど.
The second half can be left unsaid; the listener understands that it did not work.