Hello fellow scripters!
This months questions is this - Is it possible for Illustrator JS to go and grab the current username that is logged into a computer or even the computer ID? As of right now I've created a login system that people use when they first turn on illustrator that will then go and load the correct scripts onto a pallet for that user to use, but if I can have this happen automatically I can create pre-generated pallets for each user and have it grab it once illustrator is started saving some of the initial loading times per user, (about 8 people).
Right now my login scripts looks something like this;
if (globalartistname == null) { globalartistname = prompt ("enter your artist initials"); }//end if null //alert ("You user name is -- " + globalartistname) switch (globalartistname) { case "Name1": case "Name1_Lowercase": var saveName = new File ("DESKTOP" + filename); var thisDoc = app.activeDocument; if ( app.documents.length > 0 ) { saveOpts = new PDFSaveOptions(); saveOpts.compatibility = PDFCompatibility.ACROBAT6; saveOpts.generateThumbnails = true; saveOpts.preserveEditability = true; thisDoc.saveAs( saveName, saveOpts ); } break; case "Name2": case "Name2_Lowercase": //alert ("made it to CEL"); saveFileToPDF(); break; case ( "Name3_version1" || "Name3_Version2" || "Name3_Version3"): var saveName = new File ("DESKTOP" + filename); var thisDoc = app.activeDocument; if ( app.documents.length > 0 ) { saveOpts = new PDFSaveOptions(); saveOpts.compatibility = PDFCompatibility.ACROBAT6; saveOpts.generateThumbnails = true; saveOpts.preserveEditability = true; thisDoc.saveAs( saveName, saveOpts ); } break; case "Name4": case "Name4_Lowercase": //alert ("made it to AJH"); saveFileToPDF(); break; case "Name5": case "Name5_Lowercase": saveFileToPDF () break; case "Name6": case "Name6_Lowercase": saveFileToPDF () break; case "Name7": case "Name7_Lowercase": saveFileToPDF () break; case "Name8": case "Name8_Lowercase": saveFileToPDF () break; }//end switch }//end if app open }//end function savetoPDF
The above is a snippet of code from a much larger file, I've since setup the scripts to not be case sensitive but if I can grab that information on load that would save everyone loads of time and prevent any errors in the future. Names and locations have been changed for safety reasons.