joelson Posted August 11, 2012 Share Posted August 11, 2012 (edited) alternative for droplet / actionsdroplet / actions are much betterjust show how to make autoittested Adobe photoshop CS6expandcollapse popup;by Joelson0007 ;Autoitbrasil.com #RequireAdmin #include<array.au3> #include<Color.au3> ;#GLOBAL LAYERS kind VARIABLES# ;-------------------------------------- Global Const $KindNormal = 1 Global Const $KindText = 2 Global Const $KindSolidFill = 3 Global Const $KindGradientFill = 4 Global Const $KindPatternFill = 5 Global Const $KindLevels = 6 Global Const $KindCurves = 7 Global Const $KindColorBalance = 8 Global Const $KindBrightContrast = 9 Global Const $KindHueSaturation = 10 Global Const $KindSeletiveColor = 11 Global Const $KindChannelMixer = 12 Global Const $KindGradientMap = 13 Global Const $KindInversion = 14 Global Const $KindThreshold = 15 Global Const $KindPosterize = 16 ;#GLOBAL LAYERS Blend Variables ;-------------------------------------- Global const $BlendCOLORBLEND =22 Global const $BlendCOLORBURN =6 Global const $BlendCOLORDODGE =10 Global const $BlendDARKEN =4 Global const $BlendDIFFERENCE =18 Global const $BlendDISSOLVE =3 Global const $BlendEXCLUSION =19 Global const $BlendHARDLIGHT =14 Global const $BlendHUE =20 Global const $BlendLIGHTEN =8 Global const $BlendLINEARBURN =7 Global const $BlendLINEARDODGE =11 Global const $BlendLINEARLIGHT =16 Global const $BlendLUMINOSITY =23 Global const $BlendMULTIPLY =5 Global const $BlendNORMAL =2 Global const $BlendOVERLAY =12 Global const $BlendPASSTHROUGH =1 Global const $BlendPINLIGHT =17 Global const $BlendSATURATION =21 Global const $BlendSCREEN =9 Global const $BlendSOFTLIGHT =13 Global const $BlendVIVIDLIGHT =15 ;#GLOBAL Document Canvas Variables ;-------------------------------------- Global const $canvasHORIZONTAL =1 Global const $canvasVERTICAL =2 Global $aPostition,$ObjSolidColor, $aDimension,$points ; #Photoshop object# ;-------------------------------------- $app = ObjCreate("Photoshop.Application") $ObjSolidColor = ObjCreate("Photoshop.SolidColor.60");photoshop CS6 Acho para CS5 É Photoshop.SolidColor.50 $ObjSaveOptions = ObjCreate("Photoshop.JPEGSaveOptions.60");photoshop CS6 Acho para CS5 É Photoshop.JPEGSaveOptions.50 IF @error THEN Exit ; #Photoshop Hide# ;-------------------------------------- ;~ DllCall("user32.dll", "int", "LockSetForegroundWindow", "int", 2) ;~ $app.visible = false ; #Photoshop Preferencias# ============================================================================================================ $app.Preferences.RulerUnits = 1 ;(para trabalhar com pixels) $app.Preferences.TypeUnits = 1 ;(para trabalhar com pixels) $app.DisplayDialogs = 3 ;(oculta todos os dialagos) ; #Photoshop opções JPG ;-------------------------------------- With $ObjSaveOptions .EmbedColorProfile = True .FormatOptions = 1 .Matte = 1 .Quality = 1 EndWith ; #Photoshop set colors ;-------------------------------------- _setObjSolidColor(0xff00ff) $app.foregroundColor = $ObjSolidColor _setObjSolidColor(0xff0000) $app.backgroundColor = $ObjSolidColor ;#close all docs ;-------------------------------------- ; Fecha os documentos que estejam abertos no Photoshop ;~ Do While app.Documents.Count ;~ app.ActiveDocument.Close() ;~ Loop ;------------------------------ ;--- Arquivo para manipular --- ;------------------------------ $app.Open(@ScriptDir&'imagem.jpg') ;------------------------------ ;-- manipulando o documento --- ;------------------------------ $docRef = $app.activeDocument;Documento atual ;~ $docRef.flipCanvas($canvasHORIZONTAL); ;~ $docRef.flipCanvas($canvasVERTICAL); ;~ $docRef.resizeCanvas( 100,100 ); ;~ $docRef.rotateCanvas(35) ;~ $docRef.resizeImage( 500,100 ); ;~ dim $aBounds[4] = [25,25,25,25] ;------------------------------ ;---------- Selecões ---------- ;------------------------------ MsgBox(4096,"photoshop","Trabalhando com seleções") _setSel(500,200,0,50);setar seleção $selected = $docRef.selection ; ---- referecia de seleção _setObjSolidColor(0xffff00);seleciona a cor para usar na operação With $selected .select($points,1) ;preenche a seleção com a cor selecionada,muda o modo blend para LINEARBURN e seta transparencia para 50% .fill($ObjSolidColor, $BlendLINEARBURN, 50, true) .deselect() ;.selectAll();seleciona tudo ;.clear();deletar parte selecionada EndWith ;------------------------------ ;-------- Blend mode ---------- ;------------------------------ MsgBox(4096,"photoshop","Trabalhando o modo de mesclagem") $LayerA = $docRef.ArtLayers.Add() With $LayerA .name = 'LayerA' .blendMode = $BlendHUE .Kind = $KindNormal .opacity = 50 ;.visible = False ; ocultar o layer EndWith ;------------------------------ ;----- Adicionar Texto ------ ;------------------------------ MsgBox(4096,"photoshop","Adicionando o layer texto") _setObjSolidColor(0xff00);cor para esta operação $TextLayer = $docRef.ArtLayers.Add();adiconar layer With $TextLayer .Name = 'TextLayer' .Kind = $KindText ; importante; as operações abaixo só vale para um layer tipo texto .TextItem.Contents = 'Autoit Brasil' .TextItem.Position = _setPosition(100,100) .TextItem.Size = 22 .TextItem.Color=$ObjSolidColor .opacity = 50 .TextItem.font='Ravie' EndWith MsgBox(4096,"photoshop","Salvando o documetno"&@CRLF&'AutoitBrasil.com') $docRef.SaveAs(@DesktopDir&"autoitBrasil.jpg",$ObjSaveOptions,true,2) ;salvar no desktop o documento modificado ;========================== Funcoes extras Func _setObjSolidColor($hexColor) With $ObjSolidColor .RGB.Red = _ColorGetRed($hexColor) .RGB.Green = _ColorGetGreen($hexColor) .RGB.Blue = _ColorGetBlue($hexColor) EndWith Return $ObjSolidColor EndFunc Func _setPosition($x,$y) Dim $aPostition[2] = [$x,$y] Return $aPostition EndFunc Func _getDocumentDimension() Dim $aDimension[2] = [$docRef.width ,$docRef.height] Return $aDimension EndFunc Func _setSel($width,$heigth,$marginLeft,$marginTop) Dim $points[4] Dim $coordinates[2] = [$width,$marginTop] $points[0] = $coordinates Dim $coordinates[2] = [$width,$heigth] $points[1] = $coordinates Dim $coordinates[2] = [$marginLeft,$heigth] $points[2] = $coordinates Dim $coordinates[2] = [$marginLeft,$marginTop] $points[3] = $coordinates $app.activeDocument.selection.select($points,1) EndFuncautomate_photoshop.rar Edited August 11, 2012 by joelson Link to comment Share on other sites More sharing options...
JScript Posted August 11, 2012 Share Posted August 11, 2012 Nice to see you here! For those who work with this program is very good, thanks for sharing with us here too! Regards, João Carlos. http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
Belini Posted August 12, 2012 Share Posted August 12, 2012 Very good will be useful for me. My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ Link to comment Share on other sites More sharing options...
joelson Posted August 12, 2012 Author Share Posted August 12, 2012 thanks my friends Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now