D:\Windows Utilities\Icons etc\Opus status Icons\photo-camera-png-image--photo-camera-png-image-3-128x128.png,0
@script VBScript
'GATHER INFO ABOUT THE IMAGE-------------------------------------------------------
Function OnClick(ByRef clickData)
Clipstring = clickData.func.viewer.current.name
exto = clickdata.func.viewer.current.ext
pathbo = clickdata.func.viewer.current.path
pathbo = pathbo & "\" & ClipString
oldpath = clickdata.func.viewer.current.path & "\"
Set dlg = clickData.func.Dlg
dlg.template = "Capiptc"
dlg.detach = true
retval = Dlg.Show
Dim notags, resolution,tagstring, filer, selItem, otherdata, imageData, orientation, prop, title, subject, author, copyright, imagedesc, taggery,cammake,fnumber,speed
notags = (" ")
'Loop through the selected image in the Viewer to pick up get the value of the keywords
dim f : set f = clickData.func.viewer.current
For Each tag In f.metadata.tags
If (tagString <> "") Then
tagString = tagString & "; "
tagString = tagString & tag
Else
tagString = tag
End If
Next
'set the resolution calculator at 240 dpi for Canon iP4850 printer
resolution = (2.54/240)
'FILL THE FORM WITH THE VALUES GATHERED--------------------------------------------------
'Load the initial metadata values into the form and calculate the image size
set f = clickData.func.viewer.current
Set imageData = f.Metadata.image
Set otherData = f.MetaData.other
flashfire = imageData.flash
iso = imageData.isorating
speed = imageData.focallength
title = imageData.title
subject = imageData.Subject
author = imageData.mp3artist
copyright = imageData.copyright
imagedesc = imageData.imagedesc
taggery = imagedata.tags
cammake = imagedata.cameramodel
orientation = otherdata.usercomment
height = imagedata.picheight
height = height * resolution
height = Round(height,1)
width = imagedata.picwidth
' set the picture size in cms
width = width * resolution
width = Round(width,1)
'set whether pic is portrait of landscape
if height> width Then
nosemi = "Portrait"
prop = "Portrait; "
Else prop = "Landscape; "
nosemi = "Landscape"
End If
'Set EXIF data
If cammake = ("")Then
cammake = "No Exif"
End If
fnumber = imagedata.fnumber
If fnumber = ("")Then
fnumber = "No Exif"
Else
fnumber = "f " & fnumber
End If
If speed = ("")Then
speed = "No Exif"
Else
speed = imagedata.focallength & (" mm")
End If
If flashfire = ("") Then
flashfire = "No Exif"
End If
If iso = ("") Then
iso = "No Exif"
End If
'Next
'GATHER ANY CHANGES THE USER HAS MADE TO THE FORM----------------------------------------------------
'Now re-plug the metadata fields in the form with the new values (or the old values if there are no changes)
dlg.control("portrait").value = prop
dlg.control("cammodel").value = cammake
dlg.control("fstop").value = fnumber
dlg.control("focallength").value = speed
dlg.control("subject").value = subject
dlg.control("caption").value = imagedesc
dlg.control("addinfo").value = taggery
dlg.control("photog").value = author
dlg.control("copyright").value = copyright
dlg.Control("title").value = title
dlg.Control("portrait").value = nosemi
dlg.Control("dimensions").value = width
dlg.Control("dimensions1").value = height
dlg.Control("filename").value = clipstring
dlg.control("addinfo").value = tagstring
dlg.control("flashy").value = flashfire
dlg.control("ISO").value = iso
Do
Set msg = dlg.GetMsg()
Loop While msg
'set up the instructions to write new metadata to the file(s)
Dim copysymbola, captiona, subjecta, titlea, authora,taggera, testpos,orientationa,newfilebo
copysymbola = dlg.Control("copyright").Value
captiona = dlg.Control("caption").Value
subjecta = dlg.Control("subject").Value
titlea = dlg.Control ("title").Value
authora = dlg.Control("photog").Value
taggera = dlg.Control("addinfo").Value
'In case the user has decided to rename the file gather the current value of the filename and strip of the extension to avoid duplicating it
newfilebo = oldpath & dlg.Control("filename").Value
newfilebo = Replace(newfilebo, ".jpg", "")
newfilebo = Replace(newfilebo, ".psd", "")
'Now add the extension
newfilebo = newfilebo & exto
'OWN COPYRIGHT: Assume if Copyright field is plugged with "rec" then the picture is mine
If copysymbola = ("rec") Then
copysymbola = "© Rodger Clark Photography"
authora = "Rodger Clark"
End If
'Now see if the copyright field contains a copyright symbol
pos = Instr(copysymbola,"©")
'If it does then remove it to avoid duplicating
If pos = ("1") Then
copysymbola = Replace(copysymbola, "© ", "")
End If
If copysymbola =("") Then
copysymbola = copysymbola
Else
copysymbola = "© " + copysymbola
End If
'IF ANY CHANGES ARE REQUIRED WRITE THEM TO THE IMAGE FILE--------------------------
'Now check to see what metadata has been changed and needs to be re-written
'Create a command line for each field that needs changing
If copyright<>copysymbola Then
ClickData.Func.Command.AddLine("SetAttr META ""copyright:" & copysymbola & """")
End If
If authora<>author Then
ClickData.Func.Command.AddLine("SetAttr META ""author:" & authora & """")
End If
If captiona<>imagedesc Then
ClickData.Func.Command.AddLine("SetAttr META ""imagedesc:" & captiona & """")
End If
If subjecta <> subject Then
ClickData.Func.Command.AddLine("SetAttr META ""subject:" & subjecta & """")
End If
If titlea <> title Then
ClickData.Func.Command.AddLine("SetAttr META ""title:" & titlea & """")
End If
'empty the keyword field to avoid duplication
ClickData.Func.Command.AddLine("SetAttr META ""tags:" & notags & """")
'Add orientation as the first keyword taking care to remove Landscape or Portrait from existing keywords in case the picture has been cropped to the other format
taggera = Replace(taggera, "Landscape;", "")
taggera = Replace(taggera, "Portrait;", "")
taggera = "+" + prop + taggera
'Fill with new tags
ClickData.Func.Command.AddLine("SetAttr META ""tags:" & taggera & """")
ClickData.Func.Command.AddLine("Select *.* DESELECT")
ClickData.Func.command.Run
'WORKFLOW SECTION - ADD STATUS ICONS TO THE FILE------------------------------------------
'Set labels if image has been passed as colour -corrected and/or set at 240 res
if dlg.Control("radio1").value = "True" Then
cmdline = "Properties SETLABEL=PA"
clickData.func.command.RunCommand(cmdline)
End If
if dlg.Control("radio2").value = "True" Then
cmdline = "Properties SETLABEL=PA,PB,PC"
clickData.func.command.RunCommand(cmdline)
End If
if dlg.Control("radio3").value = "True" Then
cmdline = "Properties SETLABEL=PA,PB,PC,PD,PF"
clickData.func.command.RunCommand(cmdline)
End If
if dlg.Control("radio4").value = "True" Then
cmdline = "Properties SETLABEL=PA,PB,PC,PD,PE"
clickData.func.command.RunCommand(cmdline)
End If
'FILE RENAME SECTION--------------------------------------------------------------------
'See if the file needs renaming
If pathbo <> newfilebo Then
cmdline = "RENAME """ & pathbo & """ TO """ & newfilebo & """"
clickData.func.command.RunCommand(cmdline)
End If
End Function
==SCRIPT RESOURCES
<resources>
<resource name="Capiptc" type="dialog">
<dialog fontsize="10" height="300" lang="english" standard_buttons="ok,cancel" title=" IPTC METADATA FOR IMAGES IN VIEWER" width="390">
<control halign="left" height="8" name="static1" title="REPLACE FILENAME TO RENAME FILE" type="static" width="122" x="248" y="20" />
<control halign="left" height="12" name="copyright" tip="Copyright Holder" type="edit" width="161" x="52" y="44" />
<control halign="left" height="30" max="512" multiline="yes" name="caption" type="edit" width="341" x="22" y="145" />
<control halign="left" height="12" name="static2" title="Copyright:" type="static" width="37" x="14" y="46" />
<control halign="left" height="12" name="static3" title="Caption:" type="static" width="33" x="24" y="134" />
<control halign="left" height="12" name="static4" title="Subject:" type="static" width="26" x="20" y="90" />
<control halign="left" height="12" name="subject" tip="Enter the Subject" type="edit" width="298" x="56" y="89" />
<control halign="left" height="12" name="photog" tip="Photographer's name" type="edit" width="97" x="275" y="44" />
<control halign="left" height="10" name="Photographer" title="Photographer" type="static" width="44" x="221" y="46" />
<control halign="left" height="12" name="Title" title="Title:" type="static" width="22" x="21" y="115" />
<control halign="left" height="12" name="title" tip="Enter the Title" type="edit" width="141" x="49" y="114" />
<control halign="left" height="12" name="static7" title="Keywords:" type="static" width="35" x="14" y="187" />
<control halign="left" height="12" name="addinfo" tip="Add keywords separated by semi-colons" type="edit" width="321" x="60" y="186" />
<control halign="left" height="8" name="static8" title="NB: rec sets copyright and photographer to Rodger Clark" type="static" width="237" x="29" y="58" />
<control halign="left" height="12" name="Camera" title="Camera:" type="static" width="32" x="18" y="228" />
<control halign="center" height="12" name="cammodel" readonly="yes" type="edit" width="58" x="50" y="228" />
<control halign="right" height="12" name="stopper" title="f-stop: " type="static" width="29" x="195" y="228" />
<control halign="center" height="12" name="fstop" readonly="yes" type="edit" width="34" x="225" y="228" />
<control halign="left" height="12" name="static11" title="Focal length" type="static" width="40" x="115" y="228" />
<control halign="center" height="12" name="focallength" readonly="yes" type="edit" width="31" x="161" y="228" />
<control halign="left" height="12" name="static13" title="Orientation" type="static" width="38" x="226" y="116" />
<control halign="left" height="12" name="portrait" readonly="yes" title="Edit Control" type="edit" width="74" x="279" y="114" />
<control halign="left" height="9" name="static14" title="cms at 240 dpi" type="static" width="48" x="203" y="281" />
<control halign="center" height="12" name="dimensions" readonly="yes" title="Edit Control" type="edit" width="24" x="109" y="280" />
<control halign="left" height="12" name="static15" title="METADATA FOR" type="static" width="52" x="12" y="6" />
<control halign="left" height="12" name="filename" title="Edit Control" type="edit" width="303" x="69" y="5" />
<control height="46" name="group1" title="EXIF DATA" type="group" width="253" x="12" y="216" />
<control height="38" name="group2" title="OWNERSHIP" type="group" width="372" x="12" y="32" />
<control height="132" name="group3" title="IPTC PICTURE INFORMATION" type="group" width="372" x="12" y="78" />
<control height="10" name="radio1" title="Resoltion" type="radio" width="72" x="288" y="228" />
<control height="10" name="radio2" title="Colour + resolution" type="radio" width="90" x="288" y="240" />
<control height="60" name="group4" title="IMAGE CORRECTIONS" type="group" width="108" x="276" y="216" />
<control halign="center" height="12" name="dimensions1" readonly="yes" title="Edit Control" type="edit" width="30" x="167" y="280" />
<control height="24" name="group5" title="PRINT SIZE" type="group" width="252" x="12" y="272" />
<control halign="left" height="12" name="static16" title="cms by" type="static" width="23" x="140" y="281" />
<control height="10" name="radio3" title="Sent to Flickr" type="radio" width="84" x="288" y="264" />
<control height="10" name="radio4" title="Colour + res + mask" type="radio" width="90" x="288" y="252" />
<control halign="left" height="8" name="static17" title="MAX SIZE" type="static" width="36" x="64" y="282" />
<control halign="left" height="8" name="static17" title="Flash:" type="static" width="24" x="20" y="248" />
<control halign="center" height="12" name="flashy" readonly="yes" title="Edit Control" type="edit" width="72" x="52" y="246" />
<control halign="left" height="8" name="static18" title="ISO Setting:" type="static" width="42" x="162" y="248" />
<control halign="center" height="12" name="ISO" readonly="yes" title="Edit Control" type="edit" width="48" x="206" y="246" />
</dialog>
</resource>
</resources>