The DAM Forum
Welcome, Guest. Please login or register.
May 23, 2018, 04:01:06 AM

Login with username, password and session length
Search:     Advanced search
28033 Posts in 5147 Topics by 2905 Members
Latest Member: kbroch
* Home Help Search Login Register
+  The DAM Forum
|-+  Software Discussions
| |-+  Scripting
| | |-+  EM Script: Replace IPTC Description with Headline filed
« previous next »
Pages: [1] Print
Author Topic: EM Script: Replace IPTC Description with Headline filed  (Read 3786 times)
Posts: 7

View Profile WWW
« on: July 10, 2009, 09:44:51 AM »

In case anyone is interested...

I created a script for Expression Media 2 that replaces the IPTC description with the headline. It's been tested and works on EM2 service pack 2 on WinXP pro machine.

How to use it
Copy the following bold red text into a new NotePad or text editor file:

'Replaces IPTC Description with IPTC Headline text
'by Jason Tinacci 7/9/2009
'version 1.0
'Loops through selected media items and replaces description with headline

Option Explicit

Dim app, mediaItems, mediaItem, strText
Dim L_title_text, L_message1_text, L_message2_text, L_message3_text

L_title_text = "Microsoft Expression Media"
L_message1_text = "Please launch Microsoft Expression Media."
L_message2_text = "You need to select at least one media item in the active catalog in order to use this script."
L_message3_text = "This script will copy the headline to the description, for each selected media item."

' display an about box
If (MsgBox(L_message3_text, 65, L_title_text) = vbOk) Then
End If

Sub Main()
   Set app = CreateObject("ExpressionMedia.Application")

   ' get the active catalog
   If (app.Catalogs.count = 0) Then
      MsgBox L_message1_text, vbCritical, L_title_text
   Elseif (app.ActiveCatalog.Selection.Count = 0) Then
      MsgBox L_message2_text, vbCritical, L_title_text

For Each mediaItem In app.ActiveCatalog.Selection
         strText = mediaItem.Annotations.Headline
         If (strText <> "") Then
            mediaItem.Annotations.Description = strText
         End If

   End If

End Sub


Save file as "Headline to Description.vbs" to \Program Files\Microsoft Expression\Media 2\en\Plug-ins\Scripts\Annotate\.

Open EM2. Select images you want to edit. Go to Scripts > Annotate > "Headline to Description" from the menu bar to replace the description text with the headline text.

That's it.

- Jason

Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!