'-------------------------------------------------------------------------- ' ScriptDisplayString.vbs ' This script is an example of user defined Display String generation. ' The use the macro code %SF will call a function with the following ' parameters: ' - zAlb: a reference to the current album (an "Album" object), ' - zPic: a reference to the current picture (a "Picture" object), ' - zInfo: integer value (unused, reserved for future use). ' The function returns a string containing the generated text. ' Note: loading and executing a script function can be slow, this macro ' should be used for Display Strings used for printing and HTML generation ' rather than screen display. ' This example computes the amount of megapixel the picture contains. ' The %SF macro needs two parameters: the script file (use a complete path) ' and the name of the function to call: ' %SF["ScriptDisplayString.vbs",MegaPixels] '-------------------------------------------------------------------------- Option Explicit const MEGAPIX=1000000 'app.ClearTrace function MegaPixels( zAlb, zPic, zInfo ) if zInfo = 0 then ' Read mode 'App.Trace ">> MegaPixels called !!!" if zPic is nothing then MegaPixels = ">no pic !<" exit function end if dim nbPx nbPx = (zPic.w * zPic.h) / MEGAPIX ' Important: use CStr to ensure that the returned value is a string MegaPixels = CStr( round(nbPx,1) & " Megapixel" ) else zPic.sComment = app.sInfo end if end function