M
Martin111
Registriert
Thread Starter
- Dabei seit
- 03.02.2015
- Beiträge
- 2
- Reaktionspunkte
- 0
Hallo allerseits,
Ich habe untenstehendes Script (im Automator).
Es funktioniert einwandfrei. Bei einem geöffneten InDesign Dokument werden alle Seiten als JPG + PNG exportiert, dann wird das aktive Dokument geschlossen.
Aber es funktioniert leider nicht, wenn ich zum Beispiel 50 InDesign Dokumente geöffnet habe.....
Wie kann man eine Schleife einbauen, welche prüft, ob ein Dokument offen ist und die Aktion ständig wiederholt?
Wo im Script muss ich was abändern? Ich bin für jeden Tipp dankbar. Gruss Martin111
on run {input, parameters}
-- developed by macgrunt for use with InDesign
-- last updated April 2014
-- macgrunt.com
-- export jpgs and pngs from active InDesign document
tell application id "com.adobe.InDesign"
set mgFolder to file path of active document
set mgDocName to name of active document
end tell
----------------------------------
-- this bit shortens filename to first space
set text item delimiters of AppleScript to {" "}
set mgDocName to text item 1 of mgDocName
set text item delimiters of AppleScript to ""
----------------------------------
----------------------------------
-- this bit creates subfolders in the same location as the InDesign file
tell application "Finder"
if (exists folder "JPGs" of folder mgFolder) is false then
set mgJPGfolder to make new folder at mgFolder with properties {name:"JPGs"}
else
set mgJPGfolder to (mgFolder & "JPGs") as string
end if
set mgJPGfolder to mgJPGfolder as alias
if (exists folder "PNGs" of folder mgFolder) is false then
set mgPNGFolder to make new folder at mgFolder with properties {name:"PNGs"}
else
set mgPNGFolder to (mgFolder & "PNGs") as string
end if
set mgPNGFolder to mgPNGFolder as alias
end tell
tell application id "com.adobe.InDesign"
----------------------------------
-- here is where we set the export parameters
set Exporting Spread of JPEG export preferences to false
set JPEG export range of JPEG export preferences to export range
set JPEG Quality of JPEG export preferences to maximum
set jpeg color space of JPEG export preferences to RGB
set export resolution of JPEG export preferences to 72
set Exporting Spread of PNG export preferences to false
set PNG export range of PNG export preferences to export range
set PNG Quality of PNG export preferences to maximum
set PNG color space of PNG export preferences to RGB
set export resolution of PNG export preferences to 72
----------------------------------
repeat with mgCount from 1 to (count pages of active document)
set mgCount to mgCount as string
set Page String of JPEG export preferences to mgCount
set Page String of PNG export preferences to mgCount
set mgJpgFilePath to (mgJPGfolder & mgDocName & "_" & mgCount & ".jpg") as string
set mgPNGFilePath to (mgPNGFolder & mgDocName & "_" & mgCount & ".png") as string
tell active document
export format JPG to mgJpgFilePath without showing options
export format PNG format to mgPNGFilePath without showing options
end tell
end repeat
close active document
end tell
return input
end run
Ich habe untenstehendes Script (im Automator).
Es funktioniert einwandfrei. Bei einem geöffneten InDesign Dokument werden alle Seiten als JPG + PNG exportiert, dann wird das aktive Dokument geschlossen.
Aber es funktioniert leider nicht, wenn ich zum Beispiel 50 InDesign Dokumente geöffnet habe.....
Wie kann man eine Schleife einbauen, welche prüft, ob ein Dokument offen ist und die Aktion ständig wiederholt?
Wo im Script muss ich was abändern? Ich bin für jeden Tipp dankbar. Gruss Martin111
on run {input, parameters}
-- developed by macgrunt for use with InDesign
-- last updated April 2014
-- macgrunt.com
-- export jpgs and pngs from active InDesign document
tell application id "com.adobe.InDesign"
set mgFolder to file path of active document
set mgDocName to name of active document
end tell
----------------------------------
-- this bit shortens filename to first space
set text item delimiters of AppleScript to {" "}
set mgDocName to text item 1 of mgDocName
set text item delimiters of AppleScript to ""
----------------------------------
----------------------------------
-- this bit creates subfolders in the same location as the InDesign file
tell application "Finder"
if (exists folder "JPGs" of folder mgFolder) is false then
set mgJPGfolder to make new folder at mgFolder with properties {name:"JPGs"}
else
set mgJPGfolder to (mgFolder & "JPGs") as string
end if
set mgJPGfolder to mgJPGfolder as alias
if (exists folder "PNGs" of folder mgFolder) is false then
set mgPNGFolder to make new folder at mgFolder with properties {name:"PNGs"}
else
set mgPNGFolder to (mgFolder & "PNGs") as string
end if
set mgPNGFolder to mgPNGFolder as alias
end tell
tell application id "com.adobe.InDesign"
----------------------------------
-- here is where we set the export parameters
set Exporting Spread of JPEG export preferences to false
set JPEG export range of JPEG export preferences to export range
set JPEG Quality of JPEG export preferences to maximum
set jpeg color space of JPEG export preferences to RGB
set export resolution of JPEG export preferences to 72
set Exporting Spread of PNG export preferences to false
set PNG export range of PNG export preferences to export range
set PNG Quality of PNG export preferences to maximum
set PNG color space of PNG export preferences to RGB
set export resolution of PNG export preferences to 72
----------------------------------
repeat with mgCount from 1 to (count pages of active document)
set mgCount to mgCount as string
set Page String of JPEG export preferences to mgCount
set Page String of PNG export preferences to mgCount
set mgJpgFilePath to (mgJPGfolder & mgDocName & "_" & mgCount & ".jpg") as string
set mgPNGFilePath to (mgPNGFolder & mgDocName & "_" & mgCount & ".png") as string
tell active document
export format JPG to mgJpgFilePath without showing options
export format PNG format to mgPNGFilePath without showing options
end tell
end repeat
close active document
end tell
return input
end run