Hallo Leute ich war letztes Jahr schon mal hier und mir wurde super geholfen. Letztes Jahr benötigte ich ein Script um im Indesign positionierte Bilder auf 100% zu skalieren und nachzuschärfen. Script funktioniert super, aber jetzt bräuchte ich dieses Script so daß ich im Indesign die aktive Bildauswahl, entsprechend im Photoshop auf 100% setzt schärft und im Indesign dieses Bild wieder an gleicher Stelle aktualisiert!!
Ich hoffe ich finde wieder eure erfolgreiche Hilfe!
Das Script bisher:
tell application "Adobe InDesign CS2"
activate
set processedLinks to {}
-- wenn die Transformations-Vorgaben nicht als 'transformations are totals' definiert sind,
-- müssen sie angepasst werden, damit das Script richtig funktionieren kann
if transformations are totals of transform preferences is false then
set oldTransPrefs to properties of transform preferences
set transformations are totals of transform preferences to true
set show content offset of transform preferences to true
set dimensions include stroke weight of transform preferences to true
set transform content of transform preferences to true
set resetTrans to true
else
set resetTrans to false
end if
tell document 1
-- falls die Masseinheiten nicht Punkte sind, müssen sie vorübergehend geändert werden
-- damit das Script korrekt ausgeführt werden kann
if horizontal measurement units of view preferences is not points or ¬
vertical measurement units of view preferences is not points then
set oldViewPrefs to properties of view preferences
set horizontal measurement units of view preferences to points
set vertical measurement units of view preferences to points
set resetUnits to true
else
set resetUnits to false
end if
-- die Liste der Links aufstellen
set linksList to every link
-- Rückwärts-Schleife durch die Elemente der Liste
repeat with i from (count linksList) to 1 by -1
set curLink to item i of linksList
set curFile to file path of curLink as alias
set fileCreator to file creator of (info for curFile)
-- mögliche Vektor- oder Text-Dateien ausschliessen
if fileCreator is "8BIM" then
set imgName to name of curLink
set curImage to parent of curLink
set curFrame to parent of curImage
-- die Skalierungsprozente des Rahmens auf 100% zurücksetzen
reset scaling of curFrame
-- den Bildpfad feststellen
set imgPath to file path of item i of linksList as Unicode text
-- die Position des Bildes feststellen
set imgPos to geometric bounds of curImage
-- die Bildgrössen speichern
set horVal to absolute horizontal scale of curImage
set verVal to absolute vertical scale of curImage
-- die Randpositionen des Bildes ermitteln
set {y1, x1, y2, x2} to imgPos
-- wenn die Bildgrösse anders als 100% ist und die Datei noch nicht in Photoshop skaliert worden ist, dann ...
if imgPath is not in processedLinks and horVal is not 100 then
set filePath to my resizeImage(imgPath, horVal, verVal)
if filePath is not "" then
relink curLink to filePath
-- beim Updaten des Links wird das alte Link entfernt und InDesign gibt das neue zurück
set curLink to update curLink
set curImage to parent of curLink
set curFrame to parent of curImage
-- die Bildgrössen auf 100 setzen
set properties of curImage to {geometric bounds:imgPos}
resize curImage horizontal scale 100 vertical scale 100 around center anchor ¬
without considering current scale and considering parents scale
-- an die Liste den Pfad des Bildes anfügen
set end of processedLinks to imgPath
end if
else if imgPath is in processedLinks then
relink curLink to imgPath
set curLink to update curLink
set curImage to parent of curLink
set curFrame to parent of curImage
-- die Bildgrössen auf 100 setzen
set properties of curImage to {geometric bounds:imgPos}
resize curImage horizontal scale 100 vertical scale 100 around center anchor ¬
without considering current scale and considering parents scale
end if
end if
end repeat
-- die Masseinheiten zurücksetzen
if resetUnits then
tell view preferences to set properties to oldViewPrefs
end if
end tell
-- die Transformations-Vorgaben zurücksetzen
if resetTrans then
tell transform preferences to set properties to oldTransPrefs
end if
display dialog "Fertig." buttons "OK" default button 1 with icon 1 giving up after 2
end tell
-- der Handler, welcher in Photoshop das aktuelle Bild skaliert und überschreibt
on resizeImage(imgPath, horVal, verVal)
set filePath to ""
tell application "Adobe Photoshop CS2"
set bigVers to character 1 of (version as string) as integer
try
set ruler units of settings to point units
open file imgPath showing dialogs never
set docRef to current document
-- das Bild skalieren
if bigVers is less than 9 then
resize image docRef width percent (horVal / 100) height percent (verVal / 100) resample method bicubic
else
resize image docRef width percent horVal height percent verVal resample method bicubic
end if
-- das Bild schärfen
set artLayerList to get every art layer of docRef
repeat with layerRef in artLayerList
try
filter layerRef using custom filter with options ¬
{characteristics:{0, 0, 0, 0, 0, 0, 0, -1, 0, 0, 0, -1, 10, -1, 0, 0, 0, -1, 0, 0, 0, 0, 0, 0, 0}, scaling:6, offset:0}
end try
end repeat
-- das Bild sichern
set imgDoc to save docRef
-- der Variablen 'filePath' den Pfad zuweisen
set filePath to file path of imgDoc
close current document saving no
on error
try
close current document saving no
end try
end try
end tell
return filePath
end resizeImage