So first, you go to the user.cfg file, look at https://trac.wildfiregames.com/wiki/GameDataPaths to find it.
Open the file, you will see all the settings and the hotkeys.
To make a new autociv hotkey you make a new line and write: hotkey.autociv.session.entity.by.class.select.[here goes your awesome filter expression]
Basically what is does is select all the untis that that filter will return true for, the filters will be done with the existing classes the game has. A unit can can have multiple classes like Hero, Cavalry, Soldier, Ship, etc you get the idea. You combine these classes in the filter expression to select what you want. If you want to select only Cavalry then it will be "Cavalry" if you want only Ships or Trades then "Ships|Trades".
So for you case it would be:
(Ranged, infranty but no javs) -> ((Ranged or Infantry) and (no Javs) ) -> ((Ranged|Infantry)&(!Javs)) -> Now you pass it to valid names the game has Ranged:ok, Infantry:ok, Javs is called Javalineer:
hotkey.autociv.session.entity.by.class.select.(Ranged|Infantry)&(!Javalineer) = "hotkey goes here"
put this and there you have it!
So for the oposite? Just write: Javalineer
hotkey.autociv.session.entity.by.class.select.Javalineer = "Hotkey goes here"
You can look at the other hotkeys that go by "by.class.select" for more filters.
Added one new filter just now so you can filter by screen visibility. Just add to the gotkey line "by.screen.yes " to only select unit visible in the screen Download the last version to get it working
So now you have the hotkey you wanted:
hotkey.autociv.session.entity.by.screen.yes.by.class.select.(Ranged|Infantry)&(!Javalineer) = "hotkey goes here"
hotkey.autociv.session.entity.by.screen.yes.by.class.select.Javalineer = "Hotkey goes here"