Indd, Export JPEG, open in PS?

Using InDesign CS, could someone help me with any part of this request?:

Take an active selection, and somehow take that selection and export the selection as a JPG, Maximum, Baseline. (Ideally, Exporting this file to the “Desktop””yet not a necessity)
Then have Photoshop CS Open this JPEG. (Best yet, would be to have the original file on the Desktop become deleted at this point”since the Photoshop image is what we are after?).

The purpose is for us to isolate areas on InDesign Documents that include text and placed images, and then use that object/selection in Photoshop to create a sized down web logo.

Any help would be most appreciated.
Thanks,

jeff

Someone may contradict me that knows better, but looking at the dictionary you can export the page but not a selection. What might be better for your purposes is to do a screen shot of the area and open that in PS.

Actually I was able to export a selection to JPG using this “very badly” written script. “I am still very green.”

A couple issues with this though.
If the file name is extremely long, the .jpg extension will not appear?
Also, If I open an Indd document select an item, and run the script, all is well. That is, it does create a .jpg of the selection. But it also produces a idlk file (InDesign lock file) - that file will disappear when I close the indd document though.

Can anyone help me with the “name of the file issue”? If someone is ambitious, maybe there is a solution to the .idlk file???

Thanks,

jeff

tell application “InDesign CS”
set theDoc to active document
set theName to name of theDoc
set thePath to file path of theDoc as string
tell JPEG export preferences
set properties to {Exporting Selection:true, JPEG Quality:high, JPEG Rendering style:baseline encoding}
end tell
tell theDoc
export format JPG to (thePath & theName & “.jpg”) without showing options
end tell
end tell

I found a better solution for the name issue, which actually makes more sense.
I changed this line to read:
set theName to “Exported_Logo”
This way the logo will always default to a name: “Exported_Logo.jpg” in the same folder where the Indd file originated from.

Now, could Photoshop be told to somehow open that file “Exported_Logo.jpg”?

You should be able to open it with PS:

tell application "Adobe Photoshop CS"
	with timeout of 300 seconds
		activate
		open alias (thePath & theName & ".jpg") showing dialogs never
		--Do Stuff here
	end timeout
end tell

Jerome,
This is PERFECT!!!
This will be a huge timesaver. Thank you so much for your help. I did make a few minor adjustments. If you don’t mind can you please let me know if you see something dreadfully wrong with my scripting. (if nothing extremely bad exists, please don’t waste any time. You have already help me tremendously)

I decided to set the file path to a Logo folder on the desktop. This way no left behind JPEG files will exist except for this one file, that gets overwritten each time a new logo is created via the script. This behavior is preferred, since the Photoshop file will be save with a new name to a specific place.

I can’t believe it, but this script is working very nicely? I usually spend days on this stuff :slight_smile:

Many thanks,
jeff

///////////////

tell application “InDesign CS”
tell JPEG export preferences
set properties to {Exporting Selection:true, JPEG Quality:high, JPEG Rendering style:baseline encoding}
end tell
export active document format JPG to file “Illustrations:Users:admin:Desktop:Logos:Exported_Image.jpg”

end tell

tell application “Adobe Photoshop CS”
with timeout of 300 seconds
activate
open alias “Illustrations:Users:admin:Desktop:Logos:Exported_Image.jpg” showing dialogs never
–Do Stuff here
end timeout
end tell

Just as an fyi - you can export selected rectangles individually if you need to by saying:

note: this will only export the first item you select… ie: if you select a text frame - then a rectabngle
…it will only export the text frame and vica-versa - a way around this is to select all the items, then group them first. I think this could be handy for you if you have more than one ‘logo’ you want to make in a document.

set mySelection to selection
	export mySelection format JPG to (thePath & theName & ".jpg")

Chris,
I think I understand what you mean. Oddly enough I thought that such a behavior could have been a problem. But sure enough, I am able to shift-click items on my indd document (no need to group). I can then run my script, and all (and only) the selected items will be exported to a JPEG. I will still try and implement your additional script, since it does make more logical sense. But I thought you might want to know that it was performing without such limitations.