I have a word document that’s a list of 11 paragraphs per item, up to 100 items. I can copy all the paragraphs of an item in vba.
Now I want to paste what’s in the clipboard into a new document in photoshop, then use photoshop actions, or applescript, to save the new picture as a jpeg with a programmatically controlled name (pic1, pic2, etc.). Can someone point me in the right direction to have applescript get the selected paragraphs from word into photoshop, whose dictionary only seems to indicate the scriptable ability to run actions inside photoshop.
Once I get over this hump of taking the clipboard and controlling it and photoshop, I’ll be fine. Lots of programming in lots of different languages. Completely new to AppleScript.
Just getting a headstart on where I can find this information online, previous threads, other sites, etc. would be huge.
Thank you.
PhotoScripter
Some info required about the nature of the paragraphs and their content, but AppleScript can “import” the clipboard into a variable, and it can separate paragraphs of text, i.e.:
set myText to the clipboard
set myPara to paragraphs of myText
-- etc.
You don’t say anything about details, but what you want to do is probably not too hard.
Thanks for your reply.
Each paragraph is a string of 8 contiguous characters rendered in word using a special font where each
character is a symbol, like wingdings.
Once I have my 11 word paragraphs selected, the script text you showed me will put the clipboard containing
the 11 paragraph seciton into a variable. I’m constructing an image using this symbol font, character by character, line by line, into a square image, like a jigsaw puzzle. That’s what’ll be in the clipboard.
I want to convert what’s in the clipboard into a saved jpeg, and do that iteratively over the list of 11 paragraph
sections in the original word document. There may be 60 to 100 of such 11 paragraph sections. I don’t have to
do any photo correction, just take what’s in the clipboard and save it as the next numbered jpeg into a folder.
Those jpegs will then be dragged into iMovie and become successive images in a narrated quicktime movie.
I thought I’d have to use Photoshop, but now I see there’s something called “Image Events” and something called
“Graphic Converter.” Are they both scriptable?
Have I given you enough info to suggest a path, to recommend either “Image Events” or “Graphic Converter?”
thanks again for your help
I don’t think Image Events does text (maybe I’m wrong)
For what you need to do, Either Photoshop or Graphic Converter should work.
-N
I find Graphic Converter nearly impossible to script, primarily because it does not have words to determine properties of contents so you cannot always satisfy the requirements of stating required parameters for the verbs.
I’ve read all your helpful posts and looked at iMagine, which appears to do what I need.
Also, more importantly, I’ve reconsidered my approach to what the Word doc will look like.
This should make everything easier.
Rather than some arbitary number of 11 paragraph items, I will use word’s PasteAsPicture
method (VBA) to create a document that consists only of pictures, something word supports.
That means I can use AS to open the .doc, iterate over the collection of pictures in the document,
copying each to the clipboard, then pasting the clipboard as a new image into either Photoshop,
Image Events, Graphic Converter, or iMagine, and saving that new image in whichever of these tools
you recommend, as a jpeg.
I take that folder of jpegs and send it downstream in the workflow so that collection of jpegs becomes
a collection of frames in iMovie.
This should make AS code something that’s straightforward. Not only would I love to see anyone’s
code suggestion, since I’m a complete syntactic newbie, I’m very curious as to which graphic engine/tool
I should use: Photoshop, Image Events, Graphic Converter, or iMagine?
Thanks for all the kind and helpful support.
I would use Photoshop (but just because of my familiarity with it)
Both Adobe and Microsoft publish excellent reference (with code examples) documents for Photoshop and Word which you can search their sites for.
Also, doing a search right here will give you plenty of code examples. Have you actually tried coding anything yet?
-N
No. I haven’t coded anything. I’ve got to finish another project with a serious deadline. So I’m confining myself on this word/pictures solution to seeking advice here and wherever anyone else points me.
I’m a complete newbie to applescript, but have programmed for years in vb, vba, c, c++, etc. I’m pretty sure I can get Applescript to interate over the pictures in a word doc, which I’ll create using vba. I found iMagine Photo as a result of suggestions on this site.
Right now I’m curious as to the difference between iMagine Photo, Graphic Converter and Image Events. I looked around a little, but was hoping to find some basic, introductory documentation on GC or IE here or anywhere, that would give me a start to understand the tools and what they can and can’t do.
any suggestions from any quarter would be appreciated, especially as to the difference among the tools or specific locations for doucmentation.
thanks a lot
PhotoScripter
Ciao Photoscripter,
your problem seems quite complex to me and I’m not sure if I understood all the details.
I’ve jimmied around a little bit with the dictionaries of MS Word (enormous…) and some GraphicProgramms like PhotoShop, GraphicConverter, ImageEvents and Imagine. At the end the only one who I found able to collaborate with the image files created by Word was QuickTime Pro
The following snippet might help you to get started:
set saveFolder to (choose folder) as string -- choose the destination folder
tell application "Microsoft Word"
set thePars to every paragraph of document 1 -- the document you want to export the paragraphs from must be open in Word
set countPars to count of thePars
repeat with i from 1 to countPars
set aPar to item i of thePars
set theText to content of text object of aPar
set newDoc to make new document
insert text theText at text object of newDoc
set myRange to text object of paragraph 1 of active document
set name of font object of myRange to "Wingdings 2" -- during script execution the contents of theText loose its original formatation, so we have to reset the font and style information
set font size of font object of myRange to 48
copy as picture myRange -- copies the text of document 1 as a picture to the clipboard
close newDoc saving no
tell application "QuickTime Player"
activate
make new movie
paste movie 1
set pictName to ("pic" & i & ".pct") as string
set savePath to (saveFolder & pictName)
export movie 1 to file savePath as picture -- before running the script check the picture export settings of QT Pro
close movie 1
end tell
end repeat
end tell
Maybe one could even manage to prepare the entire movie sequence in QuickTime before importing it to iMovie.
Good scripting
Farid
Thank you so much for your response. I’ll take a look and work something up. I’ll get back to you and the others who’ve been so helpful when I get something running.
thanks.
PS
PS. Anyone else with ideas, I’d love to hear it.
After taking a quick look at what you wrote, Farid, I can simplify, because some of what you’ve indicated doing in AS, I’ve already got up and running in vba. I wasn’t clear enough when someone asked me if I’d done any scripting. I’ve gone all the way from reading and parsing the text input to creating the graphic images from wingdings-like fonts in word. And I can copy and paste into word as a picture.
So my starting point for AS is a single word document with an ordered collection, a list, of pictures, one after the other.
Wouldn’t this simplify the script you sent to the something like following:
set saveFolder to (choose folder) as string – choose the destination folder
tell application “Microsoft Word”
set thePars to every paragraph of document 1
set countPars to count of thePars
repeat with i from 1 to countPars
copy as picture selection – copies the text of document 1 as a picture to the clipboard
tell application "iMagine Photo" -- or graphic converter or image events????
paste image 1
set pictName to ("pic" & i & ".pct") as string
set savePath to (saveFolder & pictName)
end tell
end repeat
end tell
To the extent that you can point out which statements can be converted from psuedo code to AS,
I’d appreciate it. Since I have a picture in word and then in the clipboard, once I get the syntax right,
shouldn’t I be able to use GC, IE or iMagine Photo as the receiving/saving graphic engine? What are such
engines called within the AS community? Code resources? Scripting Additions? DLLs (heaven forbid, I’m sure)?
thak you. This is a great, helpful, friendly community. Much appreciated.