Adobe 23101764 Scripting Guide - Page 98
History object
UPC - 718659340025
View all Adobe 23101764 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 98 highlights
Scripting Photoshop 3 History object 3.15.3 Comparing Colors Using the equal colors (IsEqual/isEqual) commands, you can easily compare colors. These methods will return true if the colors are visually equal to each other and false otherwise. The examples below compare the foreground color to the background color. AS: if equal colors foreground color with background color then VB: If (appRef.ForegroundColor.IsEqual(appRef.BackgroundColor)) Then JS: if (app.foregroundColor.isEqual(backgroundColor)) 3.15.4 Getting a Web Safe Color To convert a color to a web safe color use the web safe color command on AppleScript and the NearestWebColor/nearestWebColor property on the SolidColor object for Visual Basic and JavaScript. The web safe color returned is an RGB color. AS: set myWebSafeColor to web safe color for foreground color VB: Dim myWebSafeColor As Photoshop.RGBColor Set myWebSafeColor = appRef.ForegroundColor.NearestWebColor JS: var webSafeColor = new RGBColor(); webSafeColor = app.foregroundColor.nearestWebColor; 3.16 History object Photoshop keeps a history of the actions that affect the appearance of documents. Each entry in the Photoshop History palette is considered a "History State." These states are accessable from document object and can be used to reset the document to a previous state. A history state can also be used to fill a selection. To set your document back to a particular state, set the document's current history state: AS: set current history state of current document to history state 1 ¬ of current document VB: docRef.ActiveHistoryState = docRef.HistoryStates(1) JS: docRef.activeHistoryState = docRef.historyStates[0]; Photoshop CS Scripting Guide 94