Adding on to this script to make pdfs to jpgs

hello,

I have this awesome script that makes PDF’s from InDesign or quark and puts them into a folder on my desktop called “Babs PDF Folder”.

Now, I want the script once it completes that task to take all the PDF’s in that folder and save them as 150 DPI jpegs and put them in a “Babs JPG Folder”

Cans someone help me add that onto this existing script…I can batch in acrobat, but it would be great to do this in one step instead of 2.

thanks!!
babs

property Babs_Folder : "Babs PDF Folder"
global deskPath
global PathToFolder
global PathToFolder2
global tempPictures


on open thefiles
	tell application "Finder"
		activate
		set tempPictures to (every item of (get selection)) -- MUST GET BEFORE MAKING FOLDERS
		if not (exists folder Babs_Folder) then make new folder with properties {name:Babs_Folder}
		set deskPath to desktop as text
		
		
		set PathToFolder to POSIX path of (deskPath & Babs_Folder)
		set PathToFolder2 to deskPath & Babs_Folder & ":"
	end tell
	my openfiles()
	say "Finished"
end open

on openfiles()
	try
		tell application "Finder"
			repeat with LoopFiles in tempPictures
				set foundImages to {}
				if kind of LoopFiles = "Folder" then
					try
						set foundImages to files of entire contents of LoopFiles as list
					on error
						set foundImages to files of entire contents of LoopFiles
					end try
				else
					if kind of LoopFiles is not in {"Volume", "Disk Image", "Application", "Web Internet Location", "Document", "Text Clipping"} then
						set end of foundImages to LoopFiles
					end if
				end if
				--set WorkingFile to item i of fileList
				repeat with WorkingFile in foundImages
					if not ((kind of WorkingFile starts with "Quark") or (kind of WorkingFile starts with "InDesign")) then
						activate
						display dialog "This file is not an InDesign or Quark document!" buttons "Skipping" default button "Skipping" with icon 0 giving up after 1
					else
						--Determine whether to use InDesign subroutines or Quark subroutines
						if (kind of WorkingFile starts with "InDesign") then -- Process as InDesign
							my createInDesignPDF(WorkingFile, PathToFolder2)
						else -- Process as Quark
							my createQuarkPDF(WorkingFile)
						end if
					end if
				end repeat
			end repeat
		end tell
	on error errmsg
		display dialog "OpenFiles." & return & errmsg giving up after 20
	end try
end openfiles


on createInDesignPDF(WorkingFile, savePath)
	set x to 0
	repeat
		if x = 0 then
			set newpart to ""
		else
			set newpart to " " & x
		end if
		tell application "Finder"
			set tempname to my add_extension(WorkingFile, newpart, "pdf")
			if not (exists file tempname in folder Babs_Folder) then exit repeat
		end tell
		set x to x + 1
	end repeat
	tell application "Adobe InDesign CS3"
		try
			--try
			--set user interaction level of script preferences to never interact
			--end try
			open WorkingFile as alias
			set alert missing images to true
			delay 2
			repeat
				if exists document 1 then exit repeat
				delay 0.2
			end repeat
			set theProps to properties of PDF export preset "[Press Quality]"
			set newProps to {view PDF:false, crop marks:false, bleed marks:false, color bars:false, registration marks:false} & theProps
			set oldProps to properties of PDF export preferences
			set properties of PDF export preferences to newProps
			export front document format PDF type to (savePath & tempname) without showing options
			set properties of PDF export preferences to oldProps
			delay 1
			tell documents to close saving no
			--try
			--set user interaction level of script preferences to interact with all
			--end try
		on error errmsg
			display dialog "CreateIndesignPDF." & return & errmsg giving up after 20
		end try
	end tell
end createInDesignPDF

on createQuarkPDF(WorkingFile)
	try
		set x to 0
		repeat
			if x = 0 then
				set newpart to ""
			else
				set newpart to " " & x
			end if
			tell application "Finder"
				set tempname to my add_extension(WorkingFile, newpart, "pdf")
				if not (exists file tempname in folder Babs_Folder) then exit repeat
			end tell
			set x to x + 1
		end repeat
		tell application "QuarkXPress"
			activate
			open WorkingFile as alias with «class SPRS»
			tell application "System Events" to tell process "QuarkXPress"
				click menu item "Layout as PDF..." of menu 1 of menu item "Export" of menu 1 of menu bar item "File" of menu bar 1
				delay 1
				keystroke tempname
				delay 1
				keystroke "G" using {shift down, command down}
				delay 1
				keystroke PathToFolder
				delay 1
				click button "Go" of sheet 1 of window "Export as PDF"
			end tell
			repeat 2 times
				delay 1
				activate
				tell application "System Events" to tell process "QuarkXPress"
					try
						if exists button "OK" of window 1 then
							click button "OK" of window 1
						end if
					end try
				end tell
			end repeat
			delay 1
			tell application "System Events" to tell process "QuarkXPress"
				try
					click button "Save" of window "Export as PDF"
				end try
			end tell
			repeat 4 times
				delay 1
				activate
				tell application "System Events" to tell process "QuarkXPress"
					try
						if exists button "OK" of window 1 then
							click button "OK" of window 1
						end if
					end try
					try
						if exists button "List Profiles" of window 1 then
							click button "Continue" of window 1
						end if
					end try
				end tell
			end repeat
			delay 2
			close front document saving no
		end tell
	on error errmsg
		display dialog "CreateQuarkPDF." & return & errmsg giving up after 20
	end try
end createQuarkPDF

on add_extension(WorkingFile, new_part, new_extension)
	try
		set this_info to info for WorkingFile as alias
		set this_name to the name of this_info
		set this_extension to the name extension of this_info
		if this_extension is missing value then
			set the default_name to this_name
		else
			set the default_name to text 1 thru -((length of this_extension) + 2) of this_name
		end if
		return (the default_name & new_part & "." & the new_extension)
	on error errmsg
		display dialog "add extension " & return & errmsg
	end try
end add_extension

Hi Babs,
You can export jpgs from indesign after exporting your pdfs… It doesn’t help for quark, but just a thought. This code is from something I had already, but there is a setting for resolution. I believe it would be “resolution:150” in the set properties.


tell JPEG export preferences
		set properties to {JPEG export range:export all, JPEG Quality:high, JPEG Rendering style:baseline encoding}
	end tell
	
	export document 1 format JPG to (path_to_your_folder & doc_name & ".jpg") without showing options



Andrew

Hello,
Thank you… unfortunately, I need the PDF and then the jpg to be created in that order. Long story.
So ideally, if I could add onto this script to now open each PDF and save as a jpg, and put it into another folder I indicate, that would really be what I am looking for :wink:
thanks…
babs