' Set the script type to VBScript to use this script
Option Explicit
' Main Rename entry point.
' The method is passed a GetNewNameData object for each file.
Function OnGetNewName ( ByRef GetNewNameData )
Dim item, meta
' Get the provided Item object from the GetNewNameData object's item property.
Set item = GetNewNameData.item
' Request its metadata. This will return a Metadataobject.
Set meta = item.metadata
' If the primary type of the meta data is "image" then we know it's an image file.
If meta = "image" Then
' Build and return the new name
' This is made up of
' - the "name stem" (the original filename minus the file extension)
' - the image width and height, obtained from the ImageMeta object (which comes from the Metadata.image property)
' - the original filename extension.
OnGetNewName = item.name_stem & " (" & meta.image.picwidth & "x" & meta.image.picheight & ")" & item.ext
Else
' The item wasn't an image, so return True to skip it.
OnGetNewName = True
End If
End Function