HimekoTachibana

Photoshop mouse shortcuts

Sep 19th, 2013
149
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ; http://pastebin.com/vwCj8HYd
  2. ; Photoshop Mouse Shortcuts
  3. ; Assign Ctrl-Alt-H to Layer > Hide Layers in order for the right-click shortcut to work.
  4. ;
  5. ; Right-click: Toggle current layer visibility
  6. ; Middle-click: Toggle layer mask visibility
  7. ; Scroll wheel: Zoom
  8. ; Middle-click and drag: Pan
  9. ; Back button: Previous history state
  10. ; Forward button: Next history state
  11. ; Right + Left-click: Same as Alt + Left-click (Use to set clone brush source)
  12. ; Right + Scroll wheel: Increase/Decrease Brush Size
  13. ; Right + Back/Forward: Increase/Decrease Brush Opacity
  14. ; Right + Middle-click: Swap background and foreground colors
  15.  
  16. ;*****************************************************************
  17. ;#IfWinActive, ahk_class Photoshop
  18. #If WinActive("ahk_class Photoshop") || WinActive("ahk_class OWL.DocumentWindow")
  19.     MouseIsOverDocument() {
  20.         MouseGetPos,,, id, control, 2
  21.         while (control != 0) {
  22.             WinGetClass, Class, ahk_id %control%
  23.             if(Class = "OWL.Document") {
  24.                 return true
  25.             }
  26.             control := DllCall("GetParent", "uint", control)
  27.         }
  28.         return false
  29.     }
  30.  
  31.     WheelDown::
  32.         if(MouseIsOverDocument()) {
  33.             Send, ^{-}
  34.         }
  35.         else {
  36.             Send {WheelDown}
  37.         }
  38.         return
  39.     WheelUp::
  40.         if(MouseIsOverDocument()) {
  41.             Send, ^{=}
  42.         }
  43.         else {
  44.             Send {WheelUp}
  45.         }
  46.         return
  47.  
  48.     XButton1::Send ^+z
  49.     XButton2::Send ^!z
  50.     RButton & WheelDown::Send [
  51.     RButton & WheelUp::Send ]
  52.     RButton & LButton::Send !{Click}
  53.     RButton & MButton::Send x
  54.     RButton & XButton1::Send {Enter}+{Down}{Enter}
  55.     RButton & XButton2::Send {Enter}+{Up}{Enter}
  56.    
  57.     MouseX := 0
  58.     MouseY := 0
  59.  
  60.     MButton::
  61.         MouseGetPos MouseX, MouseY
  62.         if(MouseIsOverDocument()) {
  63.             Send, {Space down}
  64.             if(GetKeyState(" ") = 1) {
  65.                 MouseClick, left,,,,,D
  66.             }
  67.             else {
  68.                 Send, {Space up}
  69.             }
  70.         }
  71.         else {
  72.             click middle
  73.         }
  74.         return
  75.     MButton UP::
  76.         if(GetKeyState(" ") = 1) {
  77.             MouseClick, left,,,,,U
  78.             Send, {Space up}
  79.         }
  80.         MouseGetPos x, y
  81.         if(MouseX = x && MouseY = y && MouseIsOverDocument()) {
  82.             Send \
  83.         }
  84.         return
  85.                
  86.     RButton::
  87.         if (MouseIsOverDocument()) {
  88.             Send ^!h
  89.         }
  90.         else {
  91.             click right
  92.         }
  93.         return
RAW Paste Data