AppleScript to solve MBA 2013 + CS6 display flickering issues

Discussion in 'Mac Programming' started by sergiobaschi, Jun 28, 2013.

  1. macrumors regular

    Joined:
    Nov 30, 2012
    Location:
    Gothenburg, Sweden
    #1
    Regarding the issues some 2013 MBA have dealing with brushes in Photoshop CS6 (mentioned here and here).

    Given that Photoshop works when running 1280x800, I'm thinking of a ad hoc solution until Mavericks (which seems to solve the issue completely) is available for all.

    I guess I could do it my self, but after trying for a few hours...

    I'm thinking of an AppleScript that runs in the background, let's say every 5th second.

    It checks if (A) Photoshop is running and (B) if the screen resolution is 1440x900.

    If (A) and (B) are TRUE -> change screen resolution to 1280x800.
    If (A) is TRUE and (B) is FALSE -> do nothing.
    If (A) is false and (B) is TRUE -> do nothing.
    If (A) and (B) are FALSE -> change screen resolution to 1440x900.

    I've managed to change the screen resolution, but have problems with the "listening for open application"-code.

    I assume there many of the people here are capable of writing this piece of code. It would surely help a lot of people until there is a more reliable solution.
     
  2. kryten2, Jun 28, 2013
    Last edited: Jun 28, 2013

    macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #2
    Check to see if the application process is running.


    Code:
    tell application "System Events"
    	if exists application process "Terminal" then
    		say "Hello"
    	end if
    end tell
    
     

    Attached Files:

  3. meme1255, Jun 28, 2013
    Last edited: Jun 28, 2013

    macrumors 6502

    Joined:
    Jul 15, 2012
    Location:
    Czech Republic
    #3
    Only simplification: (written as C-like if , I don't know how to do multiple conditions in one if using AS, sorry)

    Code:
    If ( (A == 0) &&(B == A) ) -- change screen resolution to 1280x800.
    If ( (A == 1) &&(B == A) ) -- change screen resolution to 1440x900.
    --> You don't need to care about other states, but you can use else if you want to..

    How to change resolution from terminal:
    1) According to Apple disscussions impossible directly ---> :
    // Found by google
    Code:
    --Open System Preferences on the Displays->Display tab
    tell application "System Preferences"
       reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays"
       activate
    end tell

    Code:
      select row 2 of table 1 of scroll area 1 of group 1 of tab group 1 of window 1 of process "System Preferences" -- chooses resolution ;)
    
    Try to put it together somehow :)
     

Share This Page