copy a folder and make changes in the copied folder

I try to make a script who can save me a lot of time.

I have to copy a folder (with existing indexing documents), I have to make some changes in the indesign documents.
I already get so far that I can copy the folder, and that I can make the changes. But I can’t put both scripts together in one script…


--kopieer map
tell application "Finder"
	set sourceFile to choose folder with prompt "Choose a folder to copy:"
	set targetFolder to desktop
	try
		duplicate folder sourceFile to targetFolder
	end try
	--pas marges aan	& run javascript
	tell application "Adobe InDesign CS5.5"
		activate
		set aScriptPath to "Applications:Adobe InDesign CS5.5:Scripts:Scripts Panel:SeparatePages.jsx"
		set fileList to every document of sourceFile
		repeat with aFile in fileList
			set theDoc to open aFile
			set myDocument to active document
			tell myDocument
				set left of margin preferences of every page to 13
				set right of margin preferences of every page to 13
				do script alias aScriptPath language javascript
			end tell
		end repeat
	end tell
end tell

Hi,

try this


--kopieer map
set aScriptPath to ((path to applications folder as text) & "Adobe InDesign CS5.5:Scripts:Scripts Panel:SeparatePages.jsx")
tell application "Finder"
	set sourceFolder to choose folder with prompt "Choose a folder to copy:"
	try
		set targetFolder to duplicate sourceFolder to desktop
		set fileList to every document file of targetFolder
	on error e
		display dialog "An error occurred" & return & e buttons {"Cancel"} default button 1
	end try
	--pas marges aan	& run javascript
end tell
tell application "Adobe InDesign CS5.5"
	activate
	repeat with aFile in fileList
		set myDocument to open file (aFile as text)
		tell myDocument
			set left of margin preferences of every page to 13
			set right of margin preferences of every page to 13
			do script alias aScriptPath language javascript
		end tell
	end repeat
end tell


Stefan,

thanks a lot. My script is almost ready… I am struggling with the export to interactive pdf

This is the exporting part of my script

tell application "Adobe InDesign CS5.5"
		tell active book
			set myDesktopFolder to path to desktop as string
			set myFile to myDesktopFolder & "InteractivePDF.pdf" as string
			set export layers of interactive PDF export preference to true
			set generate thumbnails of interactive PDF export preference to true
			set pdf magnification of interactive PDF export preference to fit page
			set pdf page layout of interactive PDF export preference to single page
			export format interactive PDF to myFile
		end tell
		
	end tell

If you also knows how I can fix this problem… :wink:

I don’t have CS5.5.