Script to determine display resolution

Does anyone know how to use Applescript to determine what the monitor's resolution is set at? Example: 1024 X 768. I want to center things on the screen independent of what the resolution is set to.

One way is to use the system_profiler utility:
do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep 'Resolution'" -- get info
tell the result to set {DisplayWidth, DisplayHeight} to {word 2, word 4} -- get resolution
log {DisplayWidth, DisplayHeight}

Similar Messages

  • Script to change display resolution?

    I would like to set the screen to a specific resolution when I login to a particular account and reset it when I log out. I have no idea where to start - don't see any method for changing values in System Preferences.

    01. Download and double click on 'cscreen.zip' (12 KB in size, freeware). 'cscreen' (56 KB in size) file will result.
    -- One time installation procedure:
    02. Launch 'Terminal' (in the '/Applications/Utilities/' folder).
    03. Enter ...
    open /usr/bin/
    ... and press the <return> key.
    04. Drag 'cscreen' onto the opened 'bin' window. You will have to authenticate and enter an administrators' password to continue.
    05. Close the 'bin' window.
    -- Time to script.
    06. Launch 'Script Editor' (in the '/Applications/AppleScript/' folder).
    07. Copy the code below, and paste into the 'Script Editor' 'Untitled' window.
    if (((word 16 of (do shell script "cscreen")) as number) ≠ 800) then
    do shell script "cscreen -x 800 -y 600 -r 85"
    else
    do shell script "cscreen -x 1280 -y 1024 -r 85"
    end if
    ... replacing the '800' of the first and second lines of code with the screen width you want at log in; replacing the '600' of the second line of code with the screen height you want at log in; replacing the '85' of the second line of code with the screen refresh rate you want at log in; and finally, replacing the '1280', '1024', and '85' with the desired respective screen width, screen height, and screen refresh rate you want at log out.
    08. Save the code as an application.
    09. Launch 'System Preferences' (in the '/Applications/' folder), click on 'Accounts', click on 'Login Items' tab.
    10. Drag your created application onto the 'Login Items' list.
    -- Example - if you want, at log in, the screen to be set to 1024 x 768 with a refresh rate of 100; and, at log out, the screen to be set to 800 x 600 with a refresh rate of 85 ...
    if (((word 16 of (do shell script "cscreen")) as number) ≠ 1024) then
    do shell script "cscreen -x 1024 -y 768 -r 100"
    else
    do shell script "cscreen -x 800 -y 600 -r 85"
    end if
    11. As far as 'when logging out'. You can drag the created application to the 'Dock' - where one can then click on the 'Dock' based application icon - to toggle the screen resolution; or, simply repeat Steps 06. through 10. for each account - this way the screen resolution is set as each account is logged in to.
    -- Additional information.
    -- Determining valid refresh rates for your Macs' monitor:
    In 'Terminal' enter ...
    cscreen -v
    ... and press the <return> key. Displayed in column form are the 'Index' (monitor number, '1' is typically - if only one monitor is in use), 'Depth' (8 = 256 colors, 16 = thousands of colors, 32 = millions of colors), 'Width' (screen width in pixels), 'Height' (screen height in pixels), and 'Refresh(Hz)' (screen refresh rate).
    -- Disclaimer (?):
    -- 'cscreen' continues to work through 'Tiger' (MacOS X 10.4.11). I have yet to try it on 'Leopard' (MacOS X 10.5.x).

  • Display resolution is different left and right sides

    Hi, my HP G42 laptop now has a different display resolution on the left and right sides. The left half seems to have less resolution than the right side, the right side looks like it's in HD, the left side looks washed out. I'm not sure if it is a hardware issue or a setting/software issue. The first time it appeared was after a windows 7 update was completed and installed, I'm not sure if that was just a coincidence. Any suggestions would be greatly appreciated. It works but is very annoying to look at.
    Thank you,
    Ray

    Hi Ray_M,
    Welcome to the HP Forums! I see that you are having a problem with two different resolutions on each half of your screen. The easiest way to determine where the problem lies is to connect it to an external monitor. If the image is normal then we know it is an issue with the display screen but if the issue occurs on the external monitor then we know it is a problem with the drivers or the video card itself.
    What is the product number for your g42? There are a number of different models in that series.
    Please click “Accept as Solution ” if you feel my post solved your issue.
    Click the “Kudos Thumbs Up" on the right to say “Thanks” for helping!
    Thank you,
    BHK6
    I work on behalf of HP

  • Ensuring display resolution sticks

    I have a rack of xserves, and at times, the display resolution changes, and my KVM cannot display. The optimum resolution for MiniView KVM ULTRA+: is one of the presets: 1280 x 1024 60Hz. I'm interested in any techniques to ensure it sticks. I found a scripted method:
    http://www.macosxhints.com/article.php?story=20090413120929454
    Thanks

    You need a "Dual Link" card for the 30 in order to get full res. The 9800 Pro is a "Single Link" card. Sorry but you need to exchange the 9800 for a dual link card.

  • Fixing Page Display Resolution

    Hello
    Is it possible to fix the display resolution of a PDF file at 96 pixels/inch by some means?
    I am developing some e-learning content which I would like to distribute as interactive PDF files. I intend to use InDesign CS5.5 for the layout work and have been creating some test screens.
    It falls apart when I add movies onto my pages. Once saved as an interactive PDF file and opened in Adobe Reader the quality of the movie is very dependent on the page display resolution set in the individual user's preferences.
    If they have their preference set to anything other than 96 pixels/inch the movies look poor. We develop the movies on our Macs at 72 pixels/inch and can overcome the change in resolution to 96 pixels/inch by changing the page setup to 75%. The resolution though is out of our control and i wondered if we could overcome this by some neat scripting.
    Thank you.

    Simple answer is "no, but there's another way".
    PDF pages display in physical units (points) so the concept of "100%" is actually meaningless on screen - the chances of it being 1:1 pixels are vanishingly-small even on a predictable set of hardware, and in Acrobat or Reader a "100%" scale is supposed to mean "a 210mm wide page is shown 210mm wide" - however as it has no idea of the physical size of the monitor, it's a moot point. It is certainly not the same as "100%" in Photoshop, which means "one photo pixel = one screen pixel".
    Instead, if you use a different player widget to embed your videos in Acrobat, you can set the video itself to use 1:1 pixel scaling (provided the screen rectangle is large enough of course). Flash is happy to work with pixels even when the PDF it's living inside is not.

  • Where did display resolutions go?

    I just updated from 10.7.3 to to 10.7.4 on intel 24" iMac.  In 10.7.3, I had a choice of 12 different display resolutions.  In 10.7.4, I have 2 - neither of which I find acceptable, so I reintalled 10.7.3.  Where did my choices go?
    And how do I contact Apple directly without having to pay to tell them there is a problem with their update?
    I was forced to switch to Lion so I could keep my contacts and calendars synced with all my Apple devices.  Frankly, I've been an Apple user all the way back to the IIe.  I don't like Lion.  I don't like being forced to upgrade - if those items still sync with Windows XP, why can't they in Snow Leopard?  I don't like that there is no easy way to contact Apple support about this.  I don't like the snooty and less than helpful personel at my local Apple Store.  Makes me wonder why I'm still an Apple user.

    Two Windows scripts to make playlists of Duplicates and Exact Duplicates. Use shift-delete to remove selected tracks from the library as well as the playlist.
    There is also my DeDuper script if you don't want to do it by hand. Please take note of the warning to backup your library before deduping. See this thread for background.
    tt2

  • In sap scripts how to display the driver program

    Hi,
        I Want to know the sap scripts How to display the output to driver program

    Hi,
    Go to NACE Transaction.
    Select application for ex: if sales V1.
    Click on output types.
    Select the output type for ex : BA00
    Double click on Processing routines.
    There you can find the Driver Program name and Script/smart form name.
    Reward if useful.
    Thanks,
    Raju

  • How to change external display resolution WITHOUT clicking "CONFIRM"?

    I have a somewhat unusual situation. My MacBook laptop is actually now a ModBook (a pen-tablet computer), and as such I no longer have a trackpad attached to it. All of my inputs are via the stylus, tapping directly on the built-in display.
    This works perfectly fine, except when I need to give presentations on an LCD projector (which is quite often lately). I like to use the projector as an external monitor, so that I can run the Keynote presentation on it while using my laptop screen as the presenter's display, with the upcoming slide, etc. If the projector doesn't give me an ideal native display option (sometimes, the aspect ratio for the  3 or 4 resolutions available in the Displays drop-down in the menubar turn out to be stretched or squeezed), then I, naturally, have to open the Display System Preferences and try out different resolutions.
    The problem is, since my stylus only interacts by clicking directly on the built-in-display, I have no way of moving the cursor over to the external display when the dialog box with the "Click here to confirm change/You have 15 seconds..." message appears. So I can never click it ... so I can never confirm the new settings.
    The workarounds I've used so far are:
    - Mirror displays (not ideal, as I need the presenter preview of the next slide)
    - borrow a mouse from someone (usually from a Windows desktop, frankly) and plug that in to briefly mouse over and click the confirm button
    I'd love to find a software workaround that allows me to NOT mirror displays and also doesn't require me to carry around a mouse all the time (my laptop bag is already overstuffed...).
    Thanks.

    Fateh wrote:
    I hope that my question is clear ... Nope.
    How to change the display resolution of APEX ??APEX doesn't have a display resolution. "Display resolution" is an attribute of the device and user agent software used to view the APEX page.
    What do you mean by "the display resolution of APEX"?
    In other word, if an end user sees large elements on a pageWhat "large elements"?
    then he/she zooms it outHow?
    "Zooms" what&mdash;the entire page or a single "large element"?
    How can I set a proper ZOOM for my app by default ...Meaning what?
    And as usual, we're missing:
    <li>Full APEX version
    <li>Full DB/version/edition/host OS
    <li>Web server architecture (EPG, OHS or APEX listener/host OS)
    <li>Browser(s) and version(s) used
    <li>Theme
    <li>Template(s)
    <li>Region/item type(s)
    You've been posting here for years. You know this basic information is necessary to understand and reproduce problems.
    If you're looking for help it doesn't seem unreasonable that you make the effort to provide a full, clear but concise description of the problem or requirement.

  • Thinkpad Yoga - Insufficient external display resolution over the Onelink

    My local Lenovo Partner just confirmed the data in "User Guide" of the TPYoga, that the external screen resolution will only be 1920x1200.  
    "User Guide"  Page 10, http://www.lenovo.com/shop/americas/content/user_guides/tpyoga_ug_en.pdf
    "Display resolution:
    – LCD: 1366-by-768 or 1920-by-1080, depending on the model
    – External monitor: up to 1920-by-1200, depending on the monitor model"
    I mean what do I want the OneLink Dock / OneLink PRO Dock for??
    Of cause to connect a large screen and this not with a worse ppi than the intern display. So I need at least 2560x1600
     (we don’t even talk about all the disadvantages of a 16:9 screen, cause that’s off topic).
    Idealy I expect of cause a 4k resolution possibility together with the OneLink Pro Dock and multi stream (daisy chain) possibility at the display port.
    But 1920x1200 external graphic output can’t be meant serious for a 2000US$ device?? 

    Ok, let’s accept that the new Thinkpad YOGA Manual includes misinformation.
    Actually I’m sitting in front of my 2048x1152 Display which is connected to my 8 years old Asus Notebook via DVI. Does this old jalopy perform a higher resolution via DVI than the Thinkpad Yoga via “OneLink PRO Dock-DVI” does? 
    http://download.lenovo.com/ibmdl/pub/pc/pccbbs/options/tp_onelink_pro_dock_ug_en.pdf
    Page 13
    (I’m guessing in the first line (behind "One monitor") it’s supposed to mean DVI instead of DP”
    (1) Lenovo, are these technical details of the NEW OneLink Pro Dock also wrong like the Manual of the Yoga regarding the maximum resolution?
    Would be very helpful for me to plan with correct information..
    (2) And is it definitely true that I can't connect two displays at the OneLink PRO Dock with a higher resolution than 1920x1200??
    That would mean I send the Thinkpad Yoga back and better stay with my 8 years old ASUS jalopy.. smileyfrustrated:

  • Leopard "Forgets" External Display Resolution

    I have a 17" MacBook Pro C2D (Oct 2006 revision) that I use at work with an external display (Dell E197FP) that is connected to the laptop via the DVI-to-VGA adaptor. The Dell has a native display resolution of 1280*1024 @60Hz and this is set via the System Preference's Display panel. The problem is that quite often when I connect the display in the morning OS X (10.5.6, at present) "forgets" the resolution that has been set and reverts back to its default for the display, which is 1152*864 @75Hz. It is baffling to me that it keeps forgetting the selected resolution for the display, despite recognising it, and that it selects such an odd resolution as a default. This happens about once per week at the moment.
    Does anyone have an idea what is causing this and how I can stop OS X from being so forgetful?

    Are you getting one to extend your desktop? I don't, I use my MacBook with the screen off using my external only with a keyboard and mouse plugged in. I run my Late 2008 2.1GHz MacBook with a GMA X3100 using a 23" Samsung wide ratio no problem in 1680x1050. It is high resolution. Make sure you click "mirror" in Display Prefs. Be certain that you don't simply boot to both because the external will appear grainy and only be putting out the native 1280 X 800 13" MacBook resolution on the new big LCD. There are many different ways to achieve this. With the LCD on and hooked to the MacBook, turn the MacBook on then quickly close lid after the chime. Give it some time. After it boots to the external, I open the lid to provide proper airflow, some may argue it's not needed.

  • External display resolution

    I have Dell up2414q monitor which is capable of displaying up to 3840 x 2160. But when I connect my 11-inch Macbook Air (the latest 2014 model), which is capable of 2560 x 1600, shows only 1920 x 1080. This is the highest resolution listed in display setting.
    I'm using Display Port cable and enabled Display Port 1.2 setting on the monitor. I went to Apple Store and asked, but they had no idea what was wrong. My OS is 10.9.3.

    Hi there gen2014,
    You may find the information in the article below helpful.
    OS X Mavericks: Adjust your display resolution
    http://support.apple.com/kb/PH14388
    You can connect a second display and adjust its resolution. Once it’s connected, click Scaled, then select a resolution. Press the Option key while you click Scaled to see additional resolutions for the second display.
    If you continue to experience issues, take a look at the troubleshooting steps in the article below.
    Apple computers: Troubleshooting issues with video on internal or external displays
    http://support.apple.com/kb/ht1573
    -Griff W. 

  • External Display resolution problem after resetting PRAM

    Gello, I've got Fujitsu-Siemens P19-2 monitor hooked up to my MbookPro and after resetting PRAM the correct display resolution disappeared from the "Displays" menu in System PReferences.
    So did the refresh rate option...
    What do I do?
    I really need to change the refresh rate and the resolution, but the refresh rate button is grey and unclickable, and the resolution simply isn't there (I need 1280x1024).
    REsetting PRAM and SMC didn't help.

    After a couple of resets everything went back to normal

  • External display resolution changes after returning from display sleep

    I often use an external display as a second screen with my Macbook Pro (OS X 10.8.2)  However, when I return to the computer after the display has gone to sleep, the external display resolution changes when the display reappears.  Then I have to go into System Preferences > Display and "Detect Displays" in order to return the external display to the proper resolution.
    Does anybody know of a way for me to avoid having to do this every time my display sleeps?
    Thank you,
    Adam

    I have the exact same problem.
    I found the key combination ⌘ alt F2 also restores the proper resolution on both displays, however it's still a bit annoying

  • Highest dual display resolution for mac mini mid 2011

    I am currently running a mac mini mid 2011. As I've understood (according to the below statement). Am I only able to use 2 secreen with 1920x1200 or could I use one screen with 2560x1600 and one with 1920x1200. I do NOT want mirroring, only dual displays.
    I am going to connect the screens in the following way:
    1x mini-dvi - HDMI to one screen.
    1x HDMI - HDMI to the other screen.
    Display Support:
    Dual Displays
    Resolution Support:
    1920x1200*
    Details:
    *This model simultaneously supports 1920x1200 on an HDMI display or a DVI display using the included HDMI-to-DVI adapterand 2560x1600 on a Thunderbolt or Mini DisplayPort display or even a VGA display (with an optional Mini DisplayPort-to-VGA adapter, which is compatible with the Thunderbolt port).
    2nd Display Support:
    Dual/Mirroring*
    2nd Max. Resolution:
    2560x1600*
    Details:
    *This model simultaneously supports 1920x1200 on an HDMI or a DVI display (using the included HDMI-to-DVI adapter) and2560x1600 on a Thunderbolt or Mini DisplayPort display or even a VGA display (with an optional Mini DisplayPort-to-VGA adapter, which is compatible with the Thunderbolt port).
    Thanks in advance
    Rich

    According to the copy&paste from wikipedia, HDMI should support higher resolution than 1920x1200. So the question is, does it aupport that on the mid 2011 mac mini. It says in the specifications
    "Mac mini is designed to work with HDMI devices that comply with versions 1.0, 1.1, 1.2, 1.2a, 1.3, 1.3a, and 1.4 of the HDMI specification."
    That should mean it should be able to support it, but I don't know : <
    HDMI version
    1.0
    1.1
    1.2
    1.3
    1.4
    2.0
    Date initially released
    December 9, 2002
    May 20, 2004
    August 8, 2005
    June 22, 2006
    May 28, 2009
    September 12, 2013
    Maximum clock rate (MHz)
    165
    165
    165
    340
    340[109]
    600
    Maximum TMDS throughput per channel (Gbit/s) including 8b/10b overhead
    1.65
    1.65
    1.65
    3.40
    3.40
    6
    Maximum total TMDS throughput (Gbit/s) including 8b/10b overhead
    4.95
    4.95
    4.95
    10.2
    10.2
    18
    Maximum throughput (Gbit/s) with 8b/10b overhead removed
    3.96
    3.96
    3.96
    8.16
    8.16
    14.4
    Maximum audio throughput (Mbit/s)
    36.86
    36.86
    36.86
    36.86
    36.86
    Maximum color depth (bit/px)
    24
    24
    24
    48[a]
    48
    Maximum resolution over single link at 24-bit/px[b]
    1920×1200p60
    1920×1200p60
    1920×1200p60
    2560×1600p75
    4096×2160p24
    4096×2160p60
    Maximum resolution over single link at 30-bit/px[c]
    N/A
    N/A
    N/A
    2560×1600p60
    4096×2160p24
    Maximum resolution over single link at 36-bit/px[d]
    N/A
    N/A
    N/A
    1920×1200p75
    4096×2160p24
    Maximum resolution over single link at 48-bit/px[e]
    N/A
    N/A
    N/A
    1920×1200p60
    1920×1200p60
    Maximum 3D resolution (using a full resolution 3D format) over single link at 24-bit/px
    N/A
    N/A
    N/A
    N/A
    1920×1200p60

  • Cannot  set display resolution after upgrading to Mavericks

    I have early Mac Mini  connected to KVM stitch.  Over the weekend I upgraded to Mavericks and it "dowgraded" display resolution from 1920x1200 to 1600x1200 and everythign looks streached.  1920x1200  no longer shows on the list in display properties (1920x1440 shows but it does not look good on my screen). I googled Option key trick and hitting "Scaled" while hold Option key does show some additional resolutions, but not the one I used to have. 
    Connecting Mac directly to the monitor allowed me to set proper resolution and after removing monitor and pluging mac back into KVM things "held" untill Mac goes to sleep or until reboots.
    I am aware that my KVM switch does not communicate EDID but things did work just fine before upgrade to Mavericks.

    Hello curtdav,
    It sounds like you are getting a graphical anomoly when unplugging an external monitor. I recommend these troubleshooting steps from the article named:
    Apple computers: Troubleshooting issues with video on internal or external displays
    http://support.apple.com/kb/ht1573
    Reset the system
    You can reset the Mac's parameter RAM and SMC.
    Reset the resolution
    Start by resetting the Mac's parameter RAM. If the display does not come up, was previously set to an unsupported resolution, and still results in no video:
    Start up in Safe Mode.
    From the Apple () menu, choose System Preferences.
    Choose Displays from the View menu to open the preferences pane.
    Select any resolution and refresh rate that your display supports.
    Restart your computer.
    Thank you for using Apple Support Communities.
    Take care,
    Sterling

Maybe you are looking for

  • Macbook pro mid 2014 (Magnet issue)

    Hi guys I have a macbook pro retina mid 2014 15", I've had this macbook pro for about 2 months and just yesterday i noticed a vibration/buzzing sound whilst on my lap on top of my macbook sleeve case, i noticed it made this noise when it was near the

  • Why is the sound quality and volume in itunes so different than when I use other media players

    This is an issue which has been vexing me for some time. I've researched it all over the web and have not found a worthwhile answer. Some other posts on these forums have asked similar questions without successful answers. But, none the less, I will

  • How to control text for PDF Files in the BI7.0 Broadcaster

    Hi , I am running a web template in the BI7.0 Broadcaster. The output prints in the PDF format. In the precalculation tab I have set up 4 variables(VAR1,VAR2 .. etc) . The main folder where these PDF files get stored I can control the text but dont k

  • Error ERR-1002 Unable to find item ID for item "" in application "11501"

    Hi All, I am new to Apex, still a beginner. Please need your help on this. We recently upgraded to Apex 4.1 from Apex 3.0. The database version is 10.2.0.4. I am getting this below error. Error ERR-1002 Unable to find item ID for item "" in applicati

  • External Monitor, iBook, and SwitchResX

    I recently got a 19" external monitor for my ibook this Christmas. The screen image is blurred and stretched. I called both the monitor company and apple, but neither one was helpful. I saw some discussions about SwitchResX. I downloaded it and have