Jump to content
C4 Forums | Control4

Summary Counts


jamesc4

Recommended Posts


You just mean the number of them in the project?

If you know the .c4i name of them, and have a DriverWorks driver in the project that lets you execute code in the Lua Command window, you can use something like this (which should list keypads and light-type devices based on the two proxies in the code):

local DEVICES = {["Keypads"] = "keypad_proxy.c4i", ["Lights and Switches"] = "light_v2.c4i"}
local out, tins = {}, table.insert

for title, c4i in pairs(DEVICES) do
  local count = 0
  tins(out, "----------------- " .. title .. " -----------------")
  for k,v in pairs(C4:GetDevicesByC4iName(c4i)) do
    tins(out, v)
    count = count + 1
  end
  tins(out, "----------------------------------")
  tins(out, "Total " .. title .. ": " .. count)
  tins(out, "  ")
end

print(table.concat(out, "\n"))

The table.insert / table.concat out stuff is so that the output is all printed at once, so lines don't come out of order on Lua Output.  It's also faster, although that doesn't much matter here.

RyanE

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.