Not sure about only using command scripts, but if you are comfortable making changes to the UI files, it's pretty easy to add:
Edit your
Actions.lua file, and add the following to the file (can be anywhere, bottom is fine):
function Actions.InjuredFriendly()
local lowerId = 0
local lowerHP = -1
for i = 1, table.getn(MobilesOnScreen.MobilesSort) do
local mobileId = MobilesOnScreen.MobilesSort[i]
local data = WindowData.MobileName[mobileId]
local noto = data.Notoriety+1
if (Actions.TargetAllowed(mobileId) and not IsPartyMember(mobileId) and noto == NameColor.Notoriety.INNOCENT) then
local mobileData = Interface.GetMobileData(mobileId, true)
if mobileData then
local curHealth = mobileData.CurrentHealth
if (curHealth < 25) then
if curHealth < lowerHP or lowerHP == -1 then
lowerHP = curHealth
lowerId = mobileId
end
end
end
end
end
if (lowerId ~= 0) then
HandleSingleLeftClkTarget(lowerId)
end
end
Then create a Macro with a command block for this:
script Actions.InjuredFriendly()
This will target the most critically injured blue mobile near you that isn't in your party. It scans the blue mobiles bars, so they must be enabled.
You can add this to the targeting action window as well if you want so you don't have to use a Command block each time.
Edit
ActionsWindow.lua
Go to line 274 and after "ActionsWindow.ActionData[5207]" add the following line:
ActionsWindow.ActionData[5208] = { type=SystemData.UserAction.TYPE_SPEECH_USER_COMMAND, inActionWindow=true, iconId=865002, detailString=L"Targest Lowest Health Friendly", nameString=L"Target Injured Friendly", callback=L"script Actions.InjuredFriendly()" }
Then go down to what should now be line 441, which has "ActionsWindow.Groups[6]", and in the number index on that line, add 5208 to the list:
ActionsWindow.Groups[6] = { nameString=L"Targeting", nameTid=1079383, index={ 55, 22, 71, 77, 23, 72, 78, 24, 73, 79, 69, 74, 80, 70, 75, 81, 25, 76, 82, 11, 5200, 5201, 5202, 5203, 5204, 5205, 5206, 5207, 5208 } }
This should put this new targeting action in the Actions list under Targeting