Screen Resolution with Applescript

Hi rowoflo,

You can get the screen resolution using code as follows:

Code:
set command to "/usr/sbin/system_profiler SPDisplaysDataType | grep Resolution"
set output to words of (do shell script command)
set {dspwidth, dspheight} to {item 2, item 4} of output

Best regards from Germany!
 
Hey Martin,

The /usr/sbin/system_profiler SPDisplaysDataType didn't work for me, I got file not found. But I did a little research and found that command has been replaced by system_profiler command. I used that and the rest of the code you posted and it worked out perfectly. Thanks for the help.

After looking at your reply I have a new question. How did you put the code part of your reply in separate little window? I am very new to forums, actually my original question was the very first time I had ever posted to a forum.

Thanks from Boston!
 
After looking at your reply I have a new question. How did you put the code part of your reply in separate little window? I am very new to forums, actually my original question was the very first time I had ever posted to a forum.

Just surround your code with these tags: <code>code goes here</code>. You will have to replace the '<' and '>' characters with '[' and ']'. Or just hit the # icon in the message editor :)
 
Back
Top