So, I am making a virtual assistant that responds to voice commands and replies back when the command has been executed. I am currently working on a script to increase/decrease brightness, and reply with `say "brightness increased"` or `say "brightness decreased"`

I want to set a condition that will check brightness level, and if the value is at max or min, reply saying that the brightness is at max/min value ... is there any way to check brightness level with AppleScript? I have been searching the web for hours now and I have yet to turn up any useful information on this... here is the code I have so far, with some pseudocode included for where I want to implement checking for min/max values, because at this point I'm pretty much stumped...

```
on run argv
    if (brightnessLevel = max) then              -- start of pseudocode
        say "brightness is already at max level"
        error number -128
    else if (brightnessLevel = min) then
        say "brightness is already at min level"
        error number -128                        -- end of pseudocode
    if (count of argv = 1) then
        if (item 1 of argv as string = "up") then
            tell application "System Events"
                key code 144
                say "brightness increased" using "Trinoids"
            end tell
        else if (item 1 of argv as string = "down") then
            tell application "System Events"
                key code 145
                say "brightness decreased" using "Trinoids"
            end tell
        end if
    else
        return "Error: argument count invalid"
    end if
end run

```

**Edit:** I figured I should specify, I do not want to use the `brightness` package from homebrew, because if there's a way to do this without dependencies, that's the way I want to do it.