and create a text layer with the text you wrote on the current document
how could I align the text of my text layer
let’s say 10 pixel above the bottom of my image and 10 pixel to the right ( from the left edge of my image ?)
any suggestion is welcome !!!
many thank’s, dave
AppleScript: Versione 2.1.1
Browser: Safari 417.9.2
Operating System: Mac OS X (10.4)
Dave, bottom left corner is the easier one to do, just across 10 and down the doc’s height -10. Bottom right you need to get the width of the newly made text to do the calculations before positioning. Here are examples that both work for me in CS1 using pixels for measures.
Bottom Left:
tell application "Adobe Photoshop CS"
activate
set display dialogs to never
set UserPrefs to properties of settings
set ruler units of settings to pixel units
set docRef to the current document
tell docRef
set docHeight to height of docRef
set docWidth to width of docRef
set artLayerRef to make new art layer with properties {kind:text layer}
set textItemRef to text object of artLayerRef
set font of textItemRef to "Arial"
set size of textItemRef to 72
set stroke color of textItemRef to {class:RGB color, red:0, green:0, blue:255}
set contents of contents of textItemRef to "Here's some text"
get properties of artLayerRef
set position of contents of textItemRef to {10, (docHeight - 10)}
end tell
--
set ruler units of settings to ruler units of UserPrefs
end tell
Bottom Right
tell application "Adobe Photoshop CS"
activate
set display dialogs to never
set UserPrefs to properties of settings
set ruler units of settings to pixel units
set docRef to the current document
tell docRef
set docHeight to height of docRef
set docWidth to width of docRef
set artLayerRef to make new art layer with properties {kind:text layer}
set textItemRef to text object of artLayerRef
set font of textItemRef to "Arial"
set size of textItemRef to 72
set stroke color of textItemRef to {class:RGB color, red:0, green:0, blue:255}
set contents of contents of textItemRef to "Here's some text"
get properties of artLayerRef
set TheBounds to get (bounds of artLayerRef) as list
set TypeWidth to (item 3 of TheBounds) - (item 1 of TheBounds)
set position of contents of textItemRef to {(docWidth - (TypeWidth + 10)), (docHeight - 10)}
end tell
--
set ruler units of settings to ruler units of UserPrefs
end tell
thank’s a lot for you precious help,…it works in Photoshop CS2 almost perfectly …
In fact I can’t undestand why but I’ve made some tryies with different fonts, and I’ve realized that this line does’nt work perfect:
set font of textItemRef to “Arial”
it set the font to “Myriad” even if i try other fonts like “Times” or “Lucida”…!
it only work right if I write down the font “Helvetica”
and I’m also failing in setting the style of the font to bold…can you see a solution to this?
Dave, its setting the font to the default one because it can’t find the correct name. Photoshop requires you to supply the fonts actual postscript name which in many cases differs from the one displayed in the UI for example “Helvetica Neue 95 Black” is actually “HelveticaNeue-Black” you should be able to get this info from your font management software.