|
Acoto este mensaje con algo que les puede interesar si manejan
Fireworks. Este es un comando para pasar im�genes a swf, es decir, las exportas
en swf. Lo bueno es que es r�pido y muy �til:
Copia todo este c�digo en un nuevo archivo del bloc de notas: function checkForPC(){
if(fw.platform == "win"){ return true; } else{ alert("Sorry, this script works only with Fireworks 4 for Windows\n\n" + "If you
would like to help me make the script compatible for the Mac,\n"
+
"please contact me at [EMAIL PROTECTED]"); return false;
} } function noWindowsOpen(){
if(fw.documents.length == 0){ return true; } else{ alert("Please close all documents\nbefore running this script"); return false; } } function getDocs(){
alert("Select the image files\nto batch convert to swf"); theDocList = fw.locateDocDialog(50, ["kMoaCfFormat_BMP", "kMoaCfFormat_GIF", "kMoaCfFormat_JPEG", "kMoaCfFormat_PICT", "kMoaCfFormat_TIFF", "PNG" ]); if (theDocList == null || theDocList.length == 0) { return false; }else { return true; } } function getExportPath(){
alert("Please choose an export folder");
thePath = fw.browseForFolderURL(); if (thePath == null || thePath.length == 0) { return false; } else{ return true; } } function getJPEGQuality(){
fw.dismissBatchDialogWhenDone = true; var notFinished = true; var result; while(notFinished){ JPEGQuality = prompt("Non-vector objects will be converted\n" + "to JPEG's during the export process.\n\n" +
"Please enter the JPEG quality.","75");
if(JPEGQuality ==
null){
notFinished = false; result = false; } else if(!(JPEGQuality >= 0 && JPEGQuality <= 100 && JPEGQuality == Math.round(JPEGQuality))){ alert("Please enter a valid value"); } else{ notFinished = false; result = true; } } return result; } function batchProcess(){
fw.batchStatusString = "Exporting as swf... please
wait";
fw.progressCountTotal = theDocList.length; fw.setPref("SwfMaintainObjEditable", true); fw.setPref("SwfMaintainTextEditable", false); var numOpenDocs = fw.documents.length;
for (var i = 0; i < theDocList.length; i++) { fw.progressCountCurrent = i + 1; var theDoc = theDocList[ i ]; theDocWindow = fw.openDocument(theDoc, false); fw.setActiveWindow(theDocWindow); convertToSWF(theDoc); theDocWindow.close(false); } alert("Done!"); } function convertToSWF(theDoc){
var lastSlash = theDoc.lastIndexOf("/");
//This part won't work on the Mac, since there is no last dot var lastDot = theDoc.lastIndexOf("."); var name = theDoc.substring(lastSlash+1,lastDot); var url = thePath + "/" + name + ".swf"; fw.setPref("SwfJpegQuality", JPEGQuality); fw.exportSWF(null,url); }
if(checkForPC()){
if(noWindowsOpen()){ if(getDocs()){ if(getExportPath()){ if(getJPEGQuality()){ batchProcess(); } } } } } Ahora lo guardas como "Batch para exportar como swf.jsf" y lo
guardas en la carpeta C:\Archivos de Programa\Macromedia\Fireworks
4\Configuration\Commands\
Abre el fireworks, te va al panel COMANDS y debe aparecer "Batch para...", le das click y te saldr�n diversas ventantas de aviso que son los pasos para ABRIR LA IMAGEN, ESCOGER EL FOLDER A GUARDAR, CALIDAD DE LA IMAGEN y �listo!. El patch trabaj con gifs, jpegs, bmp, tiff, pict y Fireworks PNG. El script para Mac es el siguiente:
function getDocs(){
alert("Select the image files\nto batch convert to swf"); theDocList = fw.locateDocDialog(50, ["kMoaCfFormat_BMP", "kMoaCfFormat_GIF", "kMoaCfFormat_JPEG", "kMoaCfFormat_PICT", "kMoaCfFormat_TIFF", "PNG"]); if (theDocList == null || theDocList.length == 0)
{
return false; }else { return true; } } function getExportPath(){
alert("Please choose an export folder");
thePath = fw.browseForFolderURL(); if (thePath == null || thePath.length == 0) { return false; } else{ return true; } } function getJPEGQuality(){
fw.dismissBatchDialogWhenDone = true; var notFinished = true; var result; while(notFinished){ JPEGQuality = prompt("Non-vector objects will be converted\n" + "to JPEG's during the export process.\n\n" + "Please enter the JPEG quality.","75"); if(JPEGQuality ==
null){
notFinished = false; result = false; } else if(!(JPEGQuality >= 0 && JPEGQuality <= 100 && JPEGQuality == Math.round(JPEGQuality))){ alert("Please enter a valid value"); } else{ notFinished = false; result = true; } } return result; } function batchProcess(){
fw.batchStatusString = "Exporting as swf... please
wait";
fw.progressCountTotal = theDocList.length; fw.setPref("SwfMaintainObjEditable", true); fw.setPref("SwfMaintainTextEditable", false); var numOpenDocs = fw.documents.length;
for (var i = 0; i < theDocList.length; i++) { fw.progressCountCurrent = i + 1; var theDoc = theDocList; var theDocWasOpen = false; var j = 0; while(j < numOpenDocs){ if(theDoc == fw.documents[j].filePathForRevert){ theDocWasOpen = true; theDocWindow = fw.documents[j]; } j++; } if(!theDocWasOpen){ theDocWindow = fw.openDocument(theDoc, false); }
fw.setActiveWindow(theDocWindow);
convertToSWF(theDoc); if (!theDocWasOpen){ theDocWindow.close(false); } } alert("Done!"); } function convertToSWF(theDoc){
var lastSlash = theDoc.lastIndexOf("/");
//Thanks a million to Massimo //from massimocorner.com //for making this part Mac compatible //Get the file name var fileName = theDoc.substring(lastSlash+1); //Assemble some good old RegEXp to see if the file has an extension var extPattern = /\.[a-zA-Z]*$/; //Check for a match if(extPattern.test(fileName)){ //If the file has an extension remove it from the filename fileName = fileName.replace(extPattern,""); } var url = thePath + "/" + fileName + ".swf";
fw.setPref("SwfJpegQuality", JPEGQuality); fw.exportSWF(null,url); }
if(getDocs()){
if(getExportPath()){ if(getJPEGQuality()){ batchProcess(); } } } El script es de Patrick Mineault y fue publicado en los foros
de Were-Here. Una maravilla realmente.
Saludos! |
