On Mar 13, 2012, at 13:20, Michael Ghilissen wrote: I want to write a script that would display text content on two distinct display-monitors (each one would have a distinct content), but I don't know where to start: which scriptable application, how to address the two monitors separately,...? The content would be refreshed regularly.
______________________________________________________________________
Hmm. Offhand I think I'd use Smile or TextWrangler (BBEdit for me since I own it). TextEdit could probably do the job, but I don't like scripting it much.
You can probably use 'system_profiler' in a 'so shell script' to discover your monitor parameters, but I don't presently have two monitors to test with:
system_profiler SPDisplaysDataType
I on the other hand would use an available unix executable called ' screenresolution' for this job.
The need for this stems from the fact that Applescript itself doesn't discriminate between monitors; it considers all attached screens to be one big window. Therefore you have to get the bounds of the desktop's window and then calculate the relative monitor spaces yourself.
Minerva:~ chris$ screenresolution get Display 0: 1920x1200x32
tell application "Finder" bounds of window of desktop end tell
--> {0, 0, 1920, 1200}
Of course if your system set-up is static you can probably just position windows on each monitor as you like and then get 'bounds' for them. Then your script can position them as necessary.
A simple example that does not account for multiple monitors but conveys the basic idea:
tell application "Smile" set winMon1 to make new text window with properties {name:"WinMon1", bounds:{0, 22, 845, 1196}} set winMon2 to make new text window with properties {name:"WinMon2", bounds:{1073, 22, 1918, 1196}} set text of winMon1 to "This window should be on montior 1" set text of winMon2 to "This window should be on montior 2"
delay 2
select winMon1 set text of winMon1 to "More goofy text on Monitor 1."
delay 2
select winMon2 set text of winMon2 to "More goofy text on Monitor 2." end tell
That ought to get you started.
-- Best Regards, Chris
|