Yeah, exactly. と can be used like this pretty much anywhere to say the way in which a verb is done. It is probably most common with the volitional but you do see it used like this in other contexts. When you have [Y]volitional+と[X] it means doing X in such a way that you are trying to do Y. This is clearest to see in the pattern ようとする which you came across yourself already.
As a thought exercise I’d recommend considering the difference between 〇〇と思う and 〇〇を思う, just to get a bit deeper into the nature of what と actually is doing when it is “quoting”. It can be argued that all uses of と are essentially linked (the Dictionary of Japanese Grammar series takes that stance, for example).
As for your sentence, the usage is as I said initially. Basically this is a common pattern (in fiction/narratives) which signposts pretty heavily that someone is trying to do something but then for some reason can’t. In your sentence the person wanted to scream or tried to scream but couldn’t as a blood clot came out instead.