Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

OR function

$
0
0

Does the || act as OR in a function? I wrote the below script and it only works as long as it is the first option for some of the people I have to do it this way because some of the people use 2-3 surnames depending on what they are doing.

 

//function to save a pdf to the users desktop, this only works if they put in the correct set of initials when the pallet comes up

#target illustrator

saveFileToPDF ()

function saveFileToPDF () //  saves the file to the server as a .PDF document.

{     if (globalartistname == null)    {        globalartistname = prompt ("enter your artist initials");        }//end if null                   //alert ("You user name is --  " + globalartistname)                                          var thisDoc = app.activeDocument;               if ( app.documents.length > 0 )             {                 var filename = app.activeDocument.name.replace(/\.[^\.]+$/, '');                                                 switch (globalartistname)                 {                                 case ( "drs" || "DRS"):                                     var saveName = new File ("REQUESTED LOCATION" + filename);                    break;                                 case ( "cel" || "CEL"):                                 //alert ("made it to CEL");                                     var saveName = new File ("REQUESTED LOCATION" + filename);                    break;                              case ( "rmonta" || "Rmonta" || "RMONTA"):                                     var saveName = new File ("REQUESTED LOCATION" + filename);                    break;                             case ( "ajh" || "AJH"):                               // alert ("made it to AJH");                                     var saveName = new File ("REQUESTED LOCATION" + filename);                    break;                             case ( "rob" || "ROB"):                                     var saveName = new File ("REQUESTED LOCATION" + filename);                    break;                             case ( "jdw" || "JDW"):                                     var saveName = new File ("REQUESTED LOCATION" + filename);                    break;                             case ( "tmm" || "TMM"):                                     var saveName = new File ("REQUESTED LOCATION" + filename);                    break;                             case ( "jr" || "JR"):                                     var saveName = new File ("REQUESTED LOCATION" + filename);                    break;                 }//end switch                                                        saveOpts = new PDFSaveOptions();        saveOpts.compatibility = PDFCompatibility.ACROBAT6;        saveOpts.generateThumbnails = true;        saveOpts.preserveEditability = true;        thisDoc.saveAs( saveName, saveOpts );                       }//end if
}//end function

Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>