image
image

Go Back   macosx.com > Mac Help Forums > Mac OS X System & Mac Software

Reply
 
LinkBack Thread Tools
  #1  
Old September 24th, 2008, 08:19 PM
Registered User
 
Join Date: Sep 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
rowoflo is on a distinguished road
Question Screen Resolution with Applescript

How do I get the current screen resolution using applescript or the terminal?
Reply With Quote
  #2  
Old September 25th, 2008, 04:46 AM
Registered User
 
Join Date: Sep 2008
Location: Bielefeld & Berlin, Germany
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Martin Michel is on a distinguished road
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!
Reply With Quote
  #3  
Old September 25th, 2008, 10:08 AM
Registered User
 
Join Date: Sep 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
rowoflo is on a distinguished road
Smile

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!
Reply With Quote
  #4  
Old September 25th, 2008, 10:19 AM
Registered User
 
Join Date: Sep 2008
Location: Bielefeld & Berlin, Germany
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Martin Michel is on a distinguished road
Quote:
Originally Posted by rowoflo View Post
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 :-)
Reply With Quote
  #5  
Old September 25th, 2008, 10:30 AM
Registered User
 
Join Date: Sep 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
rowoflo is on a distinguished road
Let's give it a try.

Code:
some code
Reply With Quote
  #6  
Old September 25th, 2008, 10:30 AM
Registered User
 
Join Date: Sep 2008
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
rowoflo is on a distinguished road
Awesome! Thanks again.
Reply With Quote
Reply

Bookmarks

Tags
applescript, resolution, screen, size, terminal

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off

Forum Jump


All times are GMT -5. The time now is 01:21 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.3.0 RC1
Copyright 2000-2010 DigitalCrowd, Inc.