Aide et conseils concernant AutoIt et ses outils.
-
Sea
- Niveau 6

- Messages : 219
- Enregistré le : ven. 22 juin 2012 18:51
- Localisation : France
-
Status :
Hors ligne
#1
Message
par Sea »
Salut tout le monde je cherche à enregistrer mon document en PNG mais voila je n'y arrive pas :/
Voici mon code actuel
► Afficher le texte
Code : Tout sélectionner
#include <File.au3>
#include <Array.au3>
Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc")
$oPS = Ps_Open()
;~ $file _FileListToArray("C:\Nouveau dossier")
$path = "C:\Nouveau dossier\test.jpg"
Ps_Doc_Load($oPs,$path)
SavePNG($oPs)
Func Ps_Open()
Local $oPs = ObjCreate("Photoshop.Application")
If Not IsObj($oPs) Then Return -1
Return $oPs
EndFunc
Func Ps_Doc_Load($oPs,$FullPath)
If Not IsObj($oPs) Then Return SetError(-1)
If Not FileExists($FullPath) Then Return SetError(1)
$oPs.load($FullPath)
EndFunc
Func SavePNG($oPs)
$export = ObjCreate("Photoshop.ExportOptionsSaveForWeb")
$export.format = 13
$export.PNG8 = false;
$export.quality = 100;
$oPs.activeDocument.exportDocument("C:\Nouveau dossier\test.png","",$export);
EndFunc
MsgBox(0,"PhotoShop","Sauvegarde Réussie")
Func _ErrFunc($oError)
; Do anything here.
ConsoleWrite("err.number is: " & @TAB & $oError.number & @CRLF & _
"err.windescription:" & @TAB & $oError.windescription & @CRLF & _
"err.description is: " & @TAB & $oError.description & @CRLF & _
"err.source is: " & @TAB & $oError.source & @CRLF & _
"err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _
"err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _
"err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _
"err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _
"err.retcode is: " & @TAB & $oError.retcode & @CRLF & @CRLF)
EndFunc ;==>_ErrFunc
Ca me met une erreur ligne 33 ($oPs.activeDocument.exportDocument("C:\Nouveau dossier\test.png","",$export);)
Dans la doc
http://cssdk.s3-website-us-east-1.amazo ... rtDocument(), on me dis de mettre en 2e option le type d'export sauf que je ne sais pas comment setter cette valeur
http://cssdk.s3-website-us-east-1.amazo ... tType.html.
Merci d'avance

Modifié en dernier par
Sea le mar. 10 juin 2014 05:35, modifié 1 fois.
-
Sea
- Niveau 6

- Messages : 219
- Enregistré le : ven. 22 juin 2012 18:51
- Localisation : France
-
Status :
Hors ligne
#2
Message
par Sea »
Bon je suis passé par une autre mêthode voici donc la solution
Code : Tout sélectionner
Func PS_Doc_Save_PNG($oPs,$file)
$export = ObjCreate("Photoshop.PNGSaveOptions")
$export.compression = 9
$export.interlaced = false;
$oPs.activeDocument.saveAs($file,$export,true,2);
EndFunc