Global $iEventError = 0
; Action который нужно запустить (название и действие)
Global $sActionName = "Resize", $sAction = "Action 1"
HotKeySet('{F5}', '_Curve')
HotKeySet('{F4}', '_Action')
HotKeySet('{ESC}', '_Exit')
; Точки кривой
Dim $aPoint1[2] = [0,16]
Dim $aPoint2[2] = [16,16]
Dim $aPoint3[2] = [128,128]
Dim $aPoint4[2] = [240,240]
Dim $aPoint5[2] = [255,240]
Global $aCurve[5] = [$aPoint1, $aPoint2, $aPoint3, $aPoint4, $aPoint5]
$oPS = ObjCreate("Photoshop.Application")
$oError = ObjEvent("AutoIt.Error","_PSObjErr")
$oActionDescriptor = ObjCreate("Photoshop.ActionDescriptor")
$oPS.BringToFront
$oPS.DisplayDialogs = 3
While 1
Sleep(250)
WEnd
Func _Curve()
If $oPS.Documents.Count > 0 Then
$oActiveDoc = $oPS.ActiveDocument
$oActiveLayer = $oActiveDoc.ActiveLayer
$oActiveLayer.adjustCurves($aCurve)
EndIf
EndFunc
Func _Action()
$oPS.DisplayDialogs = 3
$oPS.DoAction($sAction, $sActionName)
EndFunc
Func _Exit()
$oActionDescriptor = 0
$oError = 0
$oPS = 0
Exit
EndFunc
Func _PSObjErr()
Msgbox(0,"Photoshop","We intercepted a COM Error !" & @CRLF & @CRLF & _
"err.description is: " & @TAB & $oError.description & @CRLF & _
"err.windescription:" & @TAB & $oError.windescription & @CRLF & _
"err.number is: " & @TAB & hex($oError.number,8) & @CRLF & _
"err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
"err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
"err.source is: " & @TAB & $oError.source & @CRLF & _
"err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
"err.helpcontext is: " & @TAB & $oError.helpcontext _
)
Local $iErr = $oError.number
If $iErr = 0 Then $iErr = -1
$iEventError = $iErr
Endfunc