PDA

View Full Version : Solved: Scripting importing of clips into Clip Gallery



mansky
06-28-2007, 01:39 PM
Hi all,
I have a collection of clip art images I downloaded from the Web that I want to make available, via the Clip Gallery, to Word in Office X (10.1.8).

How does one invoke the Clip Gallery import function, via VBA, to do batch loading of images into Office? Is this even possible? OR am I stuck doing it, via the Clip Gallery GUI one-at-a-time ?


Ed

Charlize
06-29-2007, 12:01 AM
I'm not sure but if I use ctrl + a and thus selecting all the files in a directory, can't you add all the files at once when you are in the dialog to add the files ?

mansky
06-29-2007, 06:46 AM
Hi Charlize,
Yes, I am able to select multiple clips, via the GUI to Clip Gallery. What I would like to do is do the same programmatically, via a script. I do see that the Clip Gallery is AppleScript-able. I don't see any "import" function available via AppleScript however. I'll see if AS will work. Thanks!

lucas
06-29-2007, 07:13 AM
What's AppleScript?

mansky
06-29-2007, 07:43 AM
It's a scripting language available on Macintosh's that allows one to pass data from one application to another, that otherwise cannot "talk" to one another. An application is AppleScript-able if it has entries in an AppleScript dictionary file. All MS Office apps have AS entries in their respective dictionaries. I have AS Word and Excel before, but not Clip Gallery.

lucas
06-29-2007, 07:50 AM
What's Macintosh?
Just kidding....we have a friendly difference of opinion here about Macs...so I'm just teasing you for using a Mac...:devil2:

fumei
06-29-2007, 10:09 AM
Well...we can all see what side of the bed Steve is on.

mansky
07-01-2007, 01:05 PM
Hi,

Ha Ha! You got me on that Applescript Question. Hook, line and sinker!! :)

I did more digging around and came up with the following which does (partly) what I want to do.

To bring up the ClipGallery GUI programmatically, I had to resort to an old WordBasic command "InsertClipArt".

This code snippet will bring up the ClipGallery, via AppleScript,

Sub InsertClipArt()
Dim ASArg As String

ASArg = "do Visual Basic ""WordBasic.InsertClipArt"""
RetCode = MacScript(ASArg)

End Sub

To insert a particular clip art image from a given file, I found that the element wdDialogInsertPicture in the Dialogs collection class will to the trick (this time w/o Applescript!):


Sub InsertClipArtFile()
Dim IP As Dialog

Set IP = Dialogs(wdDialogInsertPicture)
RetCode = IP.Show
If (RetCode = 0) Then
Exit Sub
End If

End Sub

What I haven't figured out how to do is invoke programmatically the "Import" button on the ClipGallery GUI so that I can fully automate the addition of clip art images to Office, via the ClipGallery Database.

Along those lines, is there a command line version of the Clip Gallery Database that anyone here knows about?


Thanks!

Ed

fumei
07-03-2007, 12:31 AM
I do not think this is fully possible, but if you do find something, be sure to tell us!

mansky
07-03-2007, 11:12 AM
I am working on an AppleScript that makes use of the application process available in Word, to get programmatic access to the "Import" function of the Clip Gallery GUI. I'll keep you all informed if I can get it to work.

For now, I'll mark this thread "Solved" .