title: How to Get the Display Name with the Display ID in Mac OS X?
body: <p>I was wondering if you could help me figure out how to progmatically get the <strong>Display Name</strong> for a monitor by using its <strong>Display ID</strong> number in Mac OS X (10.5)?  A requirement is if I give a function the Display ID, it'll provide the Display Name in return (or vice versa).</p>
  <blockquote>
  <p>Display Name looks something like this: &quot;Color LCD&quot;, &quot;SAMSUNG&quot;</p>
  <p>Display ID looks something like this: &quot;69671872&quot;, &quot;893830283&quot;</p>
  </blockquote>
  <p><strong>NSScreen</strong> in Cocoa (Obj-C), or <strong>CGGetActiveDisplayList</strong> in Quartz (C), allow you to get the Display ID number for a monitor.  Neither appear to have a method to get the Display Name.  Oh no!  Here's the code for NSScreen to get the Display ID:</p>
  <pre><code>NSArray *screenArray = [NSScreen screens];
  NSDictionary *screenDescription = [[screenArray objectAtIndex:0] deviceDescription];
  NSLog(@&quot;Device ID: %@&quot;, [screenDescription objectForKey:@&quot;NSScreenNumber&quot;]);
  </code></pre>
  <p><strong>System Profiler</strong>, and <strong>Displays</strong> under <em><strong>System Preferences</strong></em>, reference displays by Display Name, not Display ID.</p>
  <p>I'm asking as I want to run an AppleScript, and it requires a Display Name rather than a Display ID.  Any help is MUCH appreciated!  :)</p>