-Kopiere nachfolgenden Code in eine neue Textdatei und Speichere sie als "puzzle.vbs"
-passe die Pfade im Code deinen Dateien an
-In deiner Puzzle.psd dürfen sich nur die Puzzle-Ebenen befinden, keine Hintergrundebene.
-das Ausgangsbild sollte die gleiche Grösse wie die Puzzle.psd haben, anderenfalls wird es dementsprechend angepasst
hier der Code:
Code:
'Anmerkungen:
'Der Pfad zur Puzzle-Datei und zum Ausgangsbild muss ersetzt werden
'Der AusgabePfad muss ersetzt werden
Dim appref
Set appref = CreateObject("Photoshop.Application")
Dim docref
'***************************************************************
bild="c:\bild.jpg" 'Hier den Pfad für das Ausgangsbild eingeben
'***************************************************************
Set docref = appref.Open(bild)
dim startRulerUnits
startRulerUnits=appRef.Preferences.RulerUnits
appref.Preferences.RulerUnits =5
'****************************************************************
puz_dat = "c:\Puzzle.psd" 'Hier den Pfad zur Puzzledatei eingeben
'****************************************************************
dim puzzle
Set puzzle = appref.Open(puz_dat)
dim docneu
Set docneu = appref.Documents.Add(puzzle.Width, puzzle.Height, puzzle.Resolution, , puzzle.Mode)
docneu.ArtLayers.Add
docneu.BackgroundLayer.Delete
appref.ActiveDocument = docref
With puzzle
If docref.Width <> .Width Or docref.Height <> .Height Then
docref.ResizeImage .Width, .Height, .Resolution, 4
End If
End With
docref.Selection.SelectAll
docref.Selection.Copy
appref.ActiveDocument = puzzle
With puzzle
.ActiveLayer = puzzle.ArtLayers(1)
.Paste
anz = .ArtLayers.Count
End With
For i = anz To 2 Step -1
appref.ActiveDocument = puzzle
puzzle.ActiveLayer = puzzle.ArtLayers(i)
DIM objApp
SET objApp = CreateObject("Photoshop.Application")
DIM dialogMode
dialogMode = 3
DIM id18
id18 = objApp.CharIDToTypeID( "setd" )
DIM desc5
SET desc5 = CreateObject( "Photoshop.ActionDescriptor" )
DIM id19
id19 = objApp.CharIDToTypeID( "null" )
DIM ref3
SET ref3 = CreateObject( "Photoshop.ActionReference" )
DIM id20
id20 = objApp.CharIDToTypeID( "Chnl" )
DIM id21
id21 = objApp.CharIDToTypeID( "fsel" )
Call ref3.PutProperty( id20, id21 )
Call desc5.PutReference( id19, ref3 )
DIM id22
id22 = objApp.CharIDToTypeID( "T " )
DIM ref4
SET ref4 = CreateObject( "Photoshop.ActionReference" )
DIM id23
id23 = objApp.CharIDToTypeID( "Chnl" )
DIM id24
id24 = objApp.CharIDToTypeID( "Chnl" )
DIM id25
id25 = objApp.CharIDToTypeID( "Trsp" )
Call ref4.PutEnumerated( id23, id24, id25 )
Call desc5.PutReference( id22, ref4 )
Call objApp.ExecuteAction( id18, desc5, dialogMode )
With puzzle
.ActiveLayer = puzzle.ArtLayers(1)
.Selection.Copy
End With
appref.ActiveDocument = docneu
With docneu
Set currenthistory = docneu.HistoryStates(4)
.Paste
.Trim 0
'************************************************************
pfad = "C:\temp\" 'Ausgabeverzeichnis hier eintragen. Achtung!!! Vorhandene Dateien werden überschrieben
'************************************************************
puzzle_neu = pfad & "Puzzle Teil" & i - 1 & ".psd"
.SaveAs puzzle_neu
.ActiveHistoryState = currenthistory
End With
Next
docneu.Close 2
puzzle.selection.deselect
appRef.Preferences.RulerUnits=startRulerUnits
ich weiss, ist nicht grad der sauberste Programmierstil, aber es funktioniert. (Bei mir jedenfalls)