Script to switch between 2 resolutions

I'm fairly new to OSX (bought my first MAC last summer)
I find myself switching between 2 resolutions on my retina MacBook Pro.
I use 1920x1080 at work (professionaly, I run Windows8 in Fusion6 to manage the IT infrastructure) and 1280x720 at home (in the couch, with half an eye on the TV)
To switch between these 2 resolutions, I do the following steps
- CMD+SPACE
- type "display"
- ENTER
- use the mouse to switch to another resolution
- press OK
Wouldn't it be easyer if I had 1 program that:
- switches to 1920x1080 if the current resolution is 1280x720
- switches to 1280x720 if the current resolution is 1920x1080
A "shortcut" (or whatever it's called in OSX) on the desktop, or even with a key-combination would be great.
Any insights?

That didn't work.
This does
local index1, index2, index3
set index1 to 3 -- 1440 x 900 (Best for Retina)
set index2 to 5 -- 1920 x 1200 (More Space)
-- Launch "System Preferences", open the "Displays" options and change to the "Display" tab
tell application "System Preferences"
  activate
          set the current pane to pane id "com.apple.preference.displays"
          reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
end tell
local indexToUse
-- Now lets make the necessary changes
tell application "System Events"
          tell window "Color LCD" of application process "System Preferences" of application "System Events"
                    tell tab group 1
  -- Click the "Scaled" radio button
  click radio button "Scaled"
                              tell radio group 1 of group 1
  -- Depending on what scale option/index is current selected, set the appropriate new option/index to use
                                        if (value of radio button index1) is true then
                                                  set indexToUse to index2
                                        else if (value of radio button index2) is true then
                                                  set indexToUse to index1
                                        end if
  -- Click the radio button for the new scale option/index
  click radio button indexToUse
                              end tell
                    end tell
  -- If option/index 1 is selected a warning prompt is displayed, click the OK button to dismiss the prompt
                    if indexToUse = 1 then
  click button "OK" of sheet 1
                    end if
          end tell
end tell
-- Quit "System Preferences"
quit application "System Preferences"
It works, but it is painfully slow

Similar Messages

  • Script to random switch between different waveforms

    Hello.
    How correctly to write the script for switch between different waveforms during generation?
    For example:
    We are using the niFgen Allocate Named Waveform VI for allocate three Waveforms. When you run Generator, working first Waveforms. Next, the Generator is switched and used in the following only second and third Waveforms.
    Or, we configured 10 Waveforms, and in the process of generating to switch not cyclically between all, but only between 2 and 5 Waveforms.
    Whether it is possible to realize?
    Max O. 
    Engineer and software developer,
    TeSLa.
    Solved!
    Go to Solution.

    Hi Chris,
    Possible that the its scripts and came to use (though I now doubt), but with instruction the if/else/end ifmust be preceded by a generate or wait <N> instruction.
    In this case, if we add generate or wait <N> instructions to this script to get Abra-Cadabra some kind.
    Clarify, what is necessary:
    When starting is not pressed any triggers that generate a waveform0 continuously.
    Further, if we passed to the niFgen Send Software Edge Trigger VI - single the triggerX, begin to generate a waveformX continuously.
    These scripts do not provide the necessary algorithms:
    May be I do not fully understand the scripts work.
    How to ensure continuous generation waveformX by a single sent of the triggerX?
    Please, prompt.
    Regards,  
    Max O.
    Engineer and software developer,
    TeSLa.

  • Is there a way to switch between workspaces in Spaces from the command line?  I want to write a script to set up certain applications in certain workspaces (without having to do it manually each time)...

    Is there a way to switch between workspaces in Spaces from the comnand line?  I use several workspaces from Spaces, each workspace having a certain number of fixed applications running.  Rather than set all this up each time I log on, I'd like to write a script from the command line (I use gawk) to automate this. Currently I have a gawk script that, given a directory, opens a few xterms whose working directory is the given directory, and opens "preview" applied to a certain file in that directory.  However, at present I have to manually move an xterm through each workspace and run my gawk script in each workspace (applied to each directory that I'm working on).
    There must be a better way...

    Addendum: Can this be done via:   open -a Spaces --args xxx  , where xxx is some set of arguments (or something like this)?

  • Switching between scripts in Advanced actions very slow on Mac OS X

    Hi,
    I've been experiencing a problem with Captivate taking an inordinate amount of time (approx 30-40 seconds) to switch between scripts in the Advanced Actions window. This happens incrementally as create/duplicate scripts and switch from one to the other. After switching about 4 to 5 times, the wait extends to 30-40 seconds. The rest of Captivate is unaffected, i.e. no delay issues when adding statements to a script, or working with other features in Captivate. I called Adobe Support but they said it is the first time they heard about this issue, although they seemed to suggest that Captivate is "slower" on the Mac. For comparison's sake, and to check if there was anything wrong with the project file itself, I tried using a trial version on a PC running Windows XP (using the same project file) and I experienced no issues, and switching between scripts remained constantly quick even after several hours working on a project.
    This particular project requires a lot of scripting and this issue has ground my productivity down to a halt having to wait 30-40seconds just to switch between scripts. Adobe suggesting "removing programs" from the Mac to speed up affairs, but I don't think there is anything wrong with the machine as it runs other Adobe software, like InDesign, Photoshop and Acrobat without any issues. In addition, while the switching is being processed, OS X doesn't hang. I am perfectly able to switch to other applications, or load new ones, which indicates that Captivate is not hogging all the resources.
    I was wondering if anyone else has experienced this issue before, and if so if a solution/workaround has been identified?
    Thanks!

    Hi,
    I've been experiencing a problem with Captivate taking an inordinate amount of time (approx 30-40 seconds) to switch between scripts in the Advanced Actions window. This happens incrementally as create/duplicate scripts and switch from one to the other. After switching about 4 to 5 times, the wait extends to 30-40 seconds. The rest of Captivate is unaffected, i.e. no delay issues when adding statements to a script, or working with other features in Captivate. I called Adobe Support but they said it is the first time they heard about this issue, although they seemed to suggest that Captivate is "slower" on the Mac. For comparison's sake, and to check if there was anything wrong with the project file itself, I tried using a trial version on a PC running Windows XP (using the same project file) and I experienced no issues, and switching between scripts remained constantly quick even after several hours working on a project.
    This particular project requires a lot of scripting and this issue has ground my productivity down to a halt having to wait 30-40seconds just to switch between scripts. Adobe suggesting "removing programs" from the Mac to speed up affairs, but I don't think there is anything wrong with the machine as it runs other Adobe software, like InDesign, Photoshop and Acrobat without any issues. In addition, while the switching is being processed, OS X doesn't hang. I am perfectly able to switch to other applications, or load new ones, which indicates that Captivate is not hogging all the resources.
    I was wondering if anyone else has experienced this issue before, and if so if a solution/workaround has been identified?
    Thanks!

  • When frequently switching between mobile and desktop view

    When I frequently switching between mobile and desktop view I have to open the layers every time since they get closed/collapsed. Adobe may need to fix it for the next version.

    You can use CTRL+# to switch between Code and Design View.
    By the way, this is the Dreamweaver Application Development forum which deals with questions about using server-side scripting languages like PHP or ColdFusion. General Dreamweaver questions should be posted in the regular Dreamweaver General Discussions forum.
    And while I´m at it: please use descriptive headlines such as "how to switch between Code and Design View" for your posts -- mentioning your screen name "Goula129" is not helpful to other users.

  • Is there a method or app to quickly switch between staff networks in the same building?

    We have a pretty standard network at my job, we have 5 staff networks, Staff A, Staff B, etc. Obviously some networks work better in different parts of the building, but I find that my macbook air tends to hold onto a weaker network and I have click on the wifi icon in the menu bar, wait for it to look for networks then click on the appropiate network. I was just wondering if anyone knew of a method or an app that makes it a little quicker for me to switch between these network. Maybe something similar to having network locations set. Thanks in advance.

    You might almost achieve your goal simply by requiring password on wake from sleep. the password prompt will have an option there to switch users.
    If you truly want to make it automatic,
    it's possible but a bit tricky.
    first download and install [Apple fast user switching applet|http://www.apple.com/applescript/accountswitcher/index.html]. install it on account of user 2 and set it up to switch to user 1 when you run it. call it, say, userswitcher.app and save it for example in user2 documents folder.
    next, copy and paste the following into text editor. format it as plain text and save it as userswitcher.sh in Documents folder as well.
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #ADD8E6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    #!/bin/bash
    idl=$"`ioreg -c IOHIDSystem | awk '/HIDIdleTime/ {print int($NF/1000000000); exit}'`"
    wt=$3600
    if [ $idl -gt $wt ]; then
    open /users/$USER/documents/userswitcher.app
    fi</pre>
    in the above wt is the wait time before switching and it's currently set to 3600 seconds (1 hour). adjust that as needed.
    next make the script unix executable by running the following terminal command
    chmod 755 ~/Documents/userswitcher.sh
    Finally, download and install [Lingon|http://tuppis.com/lingon> and make a launch daemon to run the above script every minute.
    Message was edited by: V.K.

  • Switching between page layout and word processing

    I can't seem to switch between page layout and word processing view.  I've read all the posts on this and still can't figure out why I can't just type a document into Pages.  The only option I have in page layout view is to type into text boxes, which is not what I want.  I just want to type a letter for crying out loud.
    Before I get all the rants about reading User Guides, etc.  *I have*.  I've also searched on here and in-app help and just don't understand the fuzzy/non-existant answers.  Obviously, I'm a newbie, so please don't jump all over me for this.  If it was Word - I could do this in NO time.  I just find it incredibly frustrating that inputting a normal document should be so difficult.
    Is "Pages" *not* a word processing program?  Is it just a cut and paste application?  Sorry for the tone - I mean no disrespect - it's just that I've been fooling around with this for DAYS and I just don't have time to spare anymore.  I really need to get this done.
    Can somebody give me a straightforward answer on how to just type a normal document into pages without using text boxes?
    Thanks and I apologize for not being mac-savvy.  It took some of us a lot longer to see the light =)

    Here is a script doing the conversion task for you.
    Open a Page Layout document
    run this script:
    --{code}
    set p2t to (path to temporary items from user domain) as text
    set path_2_doc to p2t & (do shell script "date +_%Y%m%d_%H%M%S.doc")
    tell application "Pages"
      save document 1 in path_2_doc
      open file path_2_doc
    end tell
    --{code}
    that's all folks.
    Yvan KOENIG (VALLAURIS, France) lundi 20 juin 2011 18:03:28
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.7
    Please : Search for questions similar to your own before submitting them to the community
    To be the AW6 successor, iWork MUST integrate a TRUE DB, not a list organizer !

  • Itunes unresponsive when switching between two devices

    For God Sake help me with this,
    i have so many apps on my iTunes(mac) ,since i updated my itunes from 11 to 12 it has been my worst nightmare ever..
    whenever i attach two or more devices ,switching between devices it becomes unresponsive so that i have to force quit iTunes
    i googled this issue,tried lots of things.but no success
    plzzzzzz help

    Paul,
    Thanks for responding.
    I'm still confused as to which field the script goes in and how to enter it in relationship to any existing script.
    Instead of me trying to explain verbally, I'll show you what I have.
    Document Hierarchy:
    Subform path & script: (I'm assuming I need one for each subform)
    xfa.host.resetData("xfa.form1.Page1.subform1");
    xfa.host.resetData("xfa.form1.Page1.subform2");
    "Radio Button List" Click Event script that shows/hides subforms:
    form1.Page1.FLOC.RadioButtonList::click - (JavaScript, client)
    if (this.rawValue == 1)
        Subform1.presence = "visible";
        Subform2.presence = "hidden";
    else if (this.rawValue == 2)
        Subform2.presence = "visible";
        Subform1.presence = "hidden";
    if (this.rawValue == 1)
        Efficiency.presence = "visible";
    if (this.rawValue == 2)
        Efficiency.presence = "visible";
    I've tried putting the script  inside the curly brackets, outside the curly brackets, at various locations within the above script, but no matter where I put it, it clears the entire form.
    Would you be so kind as to re-write the above script  properly so I can see what it's supposed to look like.
    Thanks!

  • Satellite U200-112: Switching between monitors

    Sattelite U200-112.
    At switching from the display notebook on the external monitor the resolution is exposed to the display, instead of the external monitor. Who faced such problem?

    My English language is not so perfect but I believe in your case the option called Extend my Windows desktop onto this monitor is enabled. Am I right?
    Anyway, if the external monitor is properly connected please use FN+F5 key combination to switch between notebook LCD display and external monitor.

  • How to switch between two query in Web templete.

    Hi all,
      Here i am facing problem to switch between two query in web template by using one 'table' web item. is there any way to use hyperlink 'SAP_BW_URL' and we can switch to query. here i am using these HTML code..
    <table><tr><td class="SAPBEXBtnStdBorder" cellspacing="0" cellpadding="0" border="0"><tr><td>
    <table><tr><td class="sapbexbtnstd" ><A href="<SAP_BW_URL cmd='reset_item' item='table_data' query_ID='ZSD_ZSD_M01_Q20' apply_cmd_on_target= "X">" >Switch to other query</A></td></tr></table>
    but i am not getting correct functionality.
    please help me to solve this problem.
    I know the best way to say thanks in SDN.
    thanks
    Kiran Patel

    Kiran,
      Use the web api reset_data_provider as links or in select option in HTML.
       Onchange event of this select option should call JAVASCRIPT method and
       this in turn resets the current dataprovider to your concerned one.
       How to change graphs:
       The graph item has the default data provider:
       <object>
             <param name="OWNER" value="SAP_BW"/>
             <param name="CMD" value="GET_ITEM"/>
             <param name="NAME" value="CHART_1"/>
             <param name="ITEM_CLASS" value="CL_RSR_WWW_ITEM_CHART"/>
             <param name="DATA_PROVIDER" value="DATAPROVIDER_1"/>
             <param name="TMP_CHART_DATA_HANDLE" value="IIP_49MOXB0UVNOMM6JOZMZU7QO21"/>
             ITEM:            CHART_1
       </object>
      So if you change the DATAPROVIDER_1 using RESET_DATA_PROVIDER to your concerned DP, this changes chart as well !!
       Please use this method and refer to sample code for Onchange Event on SELECT OPTION:
      <HTML>
    <HEAD>
    <script>
    function callDP() {
         if(document.forms[0].dp.value == "1") {
            //form your URL here..
           url = SAP_BW_URL_Get() + "&CMD=RESET_DATA_PROVIDER&DATA_PROVIDER_1=..&...";
            SAPBWOpenURL(url);
            //or docuemtn.location.href = url..
            //etc..
    </script>
    </HEAD>
    <BODY>
    <form>
    <select name="dp" onChange="javascript:callDP();">
    <option value="1">1</option>
    <option value="2">2</option>
    </select>
    </form>
    </BODY>
    </HTML>
    HOPE THIS HELPS !!!

  • I have a mac book pro with Windows for Mac, I have really been struggling to figure out a keyboard shortcut to switch between 2 excel files can someone suggest a solution please ?

    I have a mac book pro with Windows for Mac, I have really been struggling to figure out a keyboard shortcut to switch between 2 excel files can someone suggest a solution please ?

    someonehelpmaddy wrote:
    My Mac knows that it is connected to the montior...
    Open your Displays system preferences.  Is there an Arrangement tab and does it show two screens?  If no Arrangement tab then your mac does not know it has two screens.  Maybe smc and pram reset will shake it free and maybe not.  Maybe there's something wrong with the connection.  Thunderbolt plugs are similar to mini-displayport plugs so make sure the plug is pushed firmly in so that essentially all the metal part disappears inside the socket.  The plugs can be a little tricky in that you need to make sure the plug is fully seated in their socket.
    If you do see two screens in the Arrangement tab then click Detect Displays and Gather Windows to get the Displays preferences of the other monitor on to your main monitor.  Check the resolution and if there is a refresh rate check that as well.

  • Switch between layers in a BEx MAP

    Hi,
       Does anyone have an idea how to switch between layers in a BEx Map? And manipulate the attributes on the MAP in WAD. I ever saw a demo of such a web template which could do that.
    Thanks,
    CK

    Hi,
    here is some javascript which might be useful in your case
    function create_checkbox(mapitem) {
       var prop = SAPBWGetItemProp(mapitem);
       if (prop != null){
          map_panel_html = "<form name="map_panel_input">";
             for(k=1;k<prop.length;k++){
                if (prop[k][0].substr(0,7) == "SUBITEM") {
                              prop2=SAPBWGetItemProp(prop[k][1]);
                              hidden = true;
                              if (prop2 != null) {
                                           for(l=1;l<prop.length;l++){
                                                  if (prop2[l][0] == "HIDDEN") {
                                                        hidden = (prop2[l][1] == "X");
                              map_panel_html = map_panel_html +
                              "<input type="checkbox" name="" +prop[k][1] +
                    "" value="" + prop[k][1] +
                   "" onClick="change_map_layer(this.value, this.checked)"";
                            if (!hidden) {
                                 map_panel_html = map_panel_html + " checked";
                            map_panel_html = map_panel_html + "> "+ prop[k][1] +"<br>"    ;
         map_panel_html = map_panel_html + "</form>";
        document.getElementById("map_panel").innerHTML = map_panel_html;          
    function change_map_layer(maplayer, show) {
       if (show) {
          location.href="<SAP_BW_URL>" + "&item=" + maplayer + "&hidden="
       else {
          location.href="<SAP_BW_URL>" + "&item=" + maplayer + "&hidden=X"
    Just add additional a
    <div id="map_panel"></div>
    <script type="text/javascript">
    <!--
       create_checkbox("MAP_1")
    -->
    </script>
    in your Web Template and  replace MAP_1 with your web item name.
    This code will check the map for its layers and you can show or hide them.
    Heike

  • Timeline window missing button to switch between frame mode and timeline mode

    I'm using Photoshop CS6 Extended.
    This is what my timeline looks like now.
    In tutorials they refer to a button that should be to the left of the drop menu that says "forever". The button is supposed to allow you to switch between frame mode and timeline mode.
    this is what the timeline window looks like in timeline mode and with the button that allows you to switch.
    I've already tried reinstalling and upgrading to CS6 extended, as some forums suggested.
    Please help. Animation is the core reason that I need photoshop and without this button I'm extremely limited. Thanks.

    OK. This should work. Copy and past the below script into Script Editor, save it as an AppleScript application to the Desktop. Double-click it and it should change to grayscale. Double-click it again and it'll toggle back.
    tell application "System Preferences" to activate
    delay 1
    tell application "System Events"
    tell process "System Preferences"
    click the menu item "Universal Access" of the menu "View" of menu bar 1
    click the radio button "Seeing" of the first tab group of window "Universal Access"
    click the checkbox "Use grayscale" of tab group 1 of window "Universal Access"
    end tell
    end tell
    tell application "System Preferences" to activate
    delay 1
    tell application "System Events"
    tell process "System Preferences"
    click the menu item "Universal Access" of the menu "View" of menu bar 1
    click the radio button "Seeing" of the first tab group of window "Universal Access"
    click the checkbox "Use grayscale" of tab group 1 of window "Universal Access"
    end tell
    end tell
    tell application "System Preferences" to quit

  • Audio Menu MOtion continue play when switching between menus?

    How can encore continue playin the same background music when the user is switching between main menu and submenus? and not having to restart the song when you choose a submenu.

    There is plenty about Encore to be frustrated about, but you should spend a bit of time investigating Scenarist or DVD Lab Pro (authoring programs that provide scripting).  They are also missing some "features" (that are related to limitations of the DVD spec).  And their price tags indicate why Adobe licensed the sonic authorcore only, and not "Scenarist" itself for the Adobe authoring component.

  • Keyboad switch between layouts in Xfce

    Hi
    I added new keyboard layout from GUI (Settings->Keyboard).
    But how to switch between the layouts?
    I tried this but it doesn't work:
    nano /etc/hal/fdi/policy/10-keymap.fdi
    <?xml version="1.0" encoding="ISO-8859-1"?> <!-- -*- SGML -*- -->
    <deviceinfo version="0.2">
      <device>
        <match key="info.capabilities" contains="input.keymap">
          <append key="info.callouts.add" type="strlist">hal-setup-keymap</append>
        </match>
        <match key="info.capabilities" contains="input.keys">
          <merge key="input.xkb.rules" type="string">base</merge>
          <!-- If we're using Linux, we use evdev by default (falling back to
               keyboard otherwise). -->
          <merge key="input.xkb.model" type="string">keyboard</merge>
          <match key="/org/freedesktop/Hal/devices/computer:system.kernel.name"
                 string="Linux">
            <merge key="input.xkb.model" type="string">evdev</merge>
          </match>
          <merge key="input.xkb.layout" type="string">us,bg(phonetic)</merge>
          <merge key="input.xkb.variant" type="string"/>
    <!--      <merge key="input.xkb.layout" type="string">bg</merge> -->
          <merge key="input.xkb.options" type="string">grp:ctrl_shift_toggle,grp_led:scroll</merge>
        </match>
      </device>
    </deviceinfo>
    I look for some suggestions about adding options in my xorg.conf file, but I don't have such file.

    To switch keymaps in XFCE I'm using a small script instead of xorg.conf.

Maybe you are looking for

  • Macbook Pro to HDTV flickering

    I am currently running a mini displayport adapter to DVI to HDMI into my HDTV. I can connect and get the signal running to the TV but the signal to the TV flickers off very frequently (about every 5 to 10 seconds). I know that apple released an updat

  • Object services - manual implementation of database access layer

    Hello, this is my first time with object services. I read a lot but can't find the information which I really need to implement my requirements. I have build a persistent class, clicked to "persistence", mapped my persistent attributes. I want to use

  • JPA and Postgres

    Hi friends! I am new with EJB 3.0 and I am trying to do my first Entity Bean. I am working with Postgres and GlashFish. I have a class whose name is "Cabin", and my persistence.xml (under META-INF folder) is: <?xml version="1.0" encoding="UTF-8"?> <p

  • Which date is smaller?

    Hi, I have the "effective_date" value retrieved from a databse. I need to check if this effective_date is before or after today's date, and accordingly perform some calculations.. I have trouble finding out if this effective_date is before or after t

  • Z10 can't link to Desktop

    Phone: Z10 Current OS: 10.1.0.273 With the usb cable provided, I can previously link the Z10 to my desktop on the previous OS. I did an software upgrade about 2-3 weeks back & haven't link the phone until today. The desktop cannot detect the phone. T