//---------------------------- // Die eigendliche Bearbeitung ist hier //---------------------------- function BearbeiteEinBild(cImageName) { var result=false; if( FF_LoadExif(cImageName) && FF_HasExif() ) { if ( (FF_GetExifTag("Model") == "Canon EOS 400D DIGITAL") && (FF_GetExifTag("FocalLengthIn35mmFilm") == "" ) ) { FF_SetExifTag("FocalLengthIn35mmFilm", Math.round((1.61 * FF_GetExifTagAdvanced("FocalLength") ),0) ); FF_SaveExif(cImageName); result=true; } } return result; } //====================================================================================== function Shorten(s, maxlen) { var r = new String(s); if( r.length> maxlen ) r = r.substring(0,5) + "..." + r.substring( r.length-maxlen , r.length); return r; } //====================================================================================== // Main //====================================================================================== function Main() { var dlg = makemaindialog(); var nCurrent; var cImageName=""; var NumImages = FF_GetImageCount(); var doneImmages=0; // bis zum evtl. abbruch var aborted=false; var r; FF_SetProgressText(0, NumImages,""); FF_SetControl(dlg,"aktfile",""); try { FF_OpenDialog(dlg); for(r=""; ; ) { r=FF_ShowDialog(dlg); if (r=="CANCEL") break; if (r=="Start") break; } if (r=="Start") { for ( nCurrent = 0 ; nCurrent < NumImages ; nCurrent++ ) { var key=FF_CheckKey(); if (key==27) { if (FF_MessageBox("Script abbrechen?",4)==6) { aborted=true; break; } } cImageName = FF_getImageName(nCurrent); FF_SetProgressText(nCurrent, NumImages,cImageName); FF_SetControl(dlg,"prog",(100/NumImages*(nCurrent+1))); var msg = "" + (nCurrent+1)+" von "+NumImages + " " + Shorten(cImageName,40); FF_SetControl(dlg,"aktfile",msg); FF_LoadThumb(cImageName); FF_SetControl(dlg,"vorschau",0); FF_RefreshDialog(dlg); // Aktion..... if( BearbeiteEinBild(cImageName) ) doneImmages++; } // for FF_RefreshDialog(dlg); } // if } // try catch(e) { var msg="Script-Fehler:\r\n"; msg = msg + e + "\r\n"; msg = msg + "Fehler Nr.: 0x" + (e.number & 0x1FFFFFFF).toString(16).toUpperCase() +"\r\n"; msg = msg + e.description+"\r\n\r\n"; msg=msg+"Aktuelle Datei:\r\n"+cImageName; FF_Messagebox(msg,16); } finally { FF_CloseDialog(dlg); } if( r=="Start") { if (aborted) msg="Abbruch" else msg="Fertig"; FF_MessageBox("Selektierte Bilder: "+NumImages+"\r\n"+ "davon bearbeitet : "+doneImmages+"\r\n"+msg,64); } }