Nope.. Scripts do not have any information about opened files, let alone text selection. A macro is the only way to go.
In that case, how can I create a macro in RoboHelp that assigns a specific style to a shortcut key?
I had a quick look at Macro Express, but it seems that it only records key strokes and mouse clicks etc. This means that it only works if I have the style pod constantly open (which I do), always in the exact same position, with the same filter styles selected, and with the same CSS loaded, positioned at the same location in the scroll bar.
Am I correct in assuming this, or is there a better way to program it?
I am not sure this would be possible all the time. What's more, this script should work across multiple computers with different layouts, and with writers who don't really want to hack to get it working.
With character styles there would be the possibility to automatically switch to HTML view, cut, write <span...>, paste, write </span>, go back to design view.
But paragraph styles? That would be harder to do in HTML view, especially for multiple selected lines.