PDA

View Full Version : AppleScript to solve MBA 2013 + CS6 display flickering issues




sergiobaschi
Jun 28, 2013, 12:58 PM
Regarding the issues some 2013 MBA have dealing with brushes in Photoshop CS6 (mentioned here (http://forums.macrumors.com/showthread.php?t=1603573) and here (http://forums.macrumors.com/showthread.php?t=1603480)).

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.



kryten2
Jun 28, 2013, 01:22 PM
Check to see if the application process is running.


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

meme1255
Jun 28, 2013, 01:42 PM
Only simplification: (written as C-like if , I don't know how to do multiple conditions in one if using AS, sorry)

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
--Open System Preferences on the Displays->Display tab
tell application "System Preferences"
reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays"
activate
end tell


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 :)