La chanteuse colombienne a dévoilé son ventre rond lors d'une série de clichés réalisée au profit de l'Unicef.
C’est sans artifice que la chanteuse colombienne Shakira, 35 ans, a choisi de mettre en valeur son
alert("You're using Photoshop version " + app.version);Then fire Photoshop and go to File > Scripts > firstScript. You will see an alert box saying that “You’re using Photoshop version 12.0.0″ (or the version you’re using). The “alert” function shows a message, a string with the text and the version of the application, read from the “version” property of the “app” object. In JavaScript, you can access the properties and children of an object using the “.” operator, like in “app.version”.
if(app.documents.length > 0){ alert("There are " + app.documents.length + " open documents"); }else{ alert("There are no open documents"); }If you launch the script (File > Scripts > firstScript), the alert message will change depending on the number of currently open documents. The code is very simple, the first line checks if the number of open documents (that is, the length of the set of documents in the app) is greater than zero, showing a message with that number. Otherwise, it shows a message saying there are no open documents. Easy, isn’t it? But so far this does not look too useful.
if(app.documents.length > 0){ var numberColumns = parseInt( prompt("How many columns do you need?", 5) ); var doc = app.activeDocument; var documentWidth = doc.width; var columnWidth = documentWidth / numberColumns; for(i = 0; i <= numberColumns; ++i){ doc.guides.add(Direction.VERTICAL, i * columnWidth); } }Don't be scared! The code is very easy. You already know what the first line means: "if there's at least one open document, do the following". The next line uses the "prompt" function to ask the user for the number of columns, and passes its result to the "parseInt" function, that conveniently converts it into an integer. The result is stored in the "numberColumns" variable. Just in case you don't know it, variables are used in programming languages to store values, so if you want to save a certain value, you use a variable.
if(app.documents.length != 0){ var doc = app.activeDocument; for(i = 0; i < doc.artLayers.length; ++i){ var layer = doc.artLayers[i]; if(layer.kind == LayerKind.TEXT){ layer.textItem.font = "ArialMT"; layer.textItem.contents += " © 2011 Envato"; } } }
if(app.documents.length > 0){ var doc = app.activeDocument; var squareSize = parseInt( prompt("Select the size of the square", 50)); var squareColor = new RGBColor; squareColor.hexValue = prompt("Select the color of the square (hexadecimal)", "ff0000"); var newLayer = doc.artLayers.add(); newLayer.name = "Square - " + squareSize + " - " + squareColor.hexValue; selectedRegion = Array(Array(0,0), Array(0, squareSize), Array(squareSize, squareSize), Array(squareSize, 0)); doc.selection.select(selectedRegion); doc.selection.fill(squareColor); doc.selection.deselect(); }This is the longest code we've seen so far, but it's not hard to understand. In the third line, we ask the user for the size of the square and store it in the "squareSize" variable. Next, we create a new RGBColor to specify the color of the square, and we read the hexadecimal value from the user input.