|
|
#1 |
|
applescript with Photshop text layers
Hello,
I was wondering how to edit text layers in adobe photoshop via applescript. I am trying to create multiple input boxes and paste the text from the applescript to a photoshop Text Layer. For example, I ask for an input of "Last Name" in applescript and want the text layer to paste the "last name" in photshop to the edited Last Name text layer. I am very new too applescript so I would appreicate if the community can point me in the right direction. Code:
display dialog "Last Name?" default answer "Last Name" set theanswer to (text returned of result) display dialog theanswer tell application "Adobe Photoshop CS5" set current layer to "Last Name" clear layer "Last Name" paste theanswer to "Last Name" end tell Last edited by troyman11; Mar 15, 2013 at 03:55 PM. |
|
|
|
0
|
|
|
#2 |
|
not really sure what you're trying to do but you could probably get it done using imagemagick.
|
|
|
|
0
|
|
|
#3 | |
|
Quote:
Code:
set firstName to text returned of (display dialog "First Name" default answer "Bill" buttons {"OK"} default button 1)
set lastName to text returned of (display dialog "Last Name" default answer "Gates" buttons {"OK"} default button 1)
-- Change tell application line below to your version of Photoshop
tell application "Adobe Photoshop CS6"
--set theLayers to every art layer of current document
--get properties of art layer 1 of current document
--set kind of art layer 1 of current document to text layer
--set kind of art layer 2 of current document to text layer
--get properties of text object of art layer 1 of current document
get contents of text object of art layer 1 of current document
get contents of text object of art layer 2 of current document
set contents of text object of art layer 1 of current document to lastName
set contents of text object of art layer 2 of current document to firstName
end tell
Code:
set firstName to text returned of (display dialog "First Name" default answer "Steve" buttons {"OK"} default button 1)
set lastName to text returned of (display dialog "Last Name" default answer "Jobs" buttons {"OK"} default button 1)
-- Change tell application line below to your version of Photoshop
tell application "Adobe Photoshop CS6"
make new document with properties {name:"Testtextlayers"}
make new art layer at current document with properties {name:"First Name", kind:text layer}
make new art layer at current document with properties {name:"Last Name", kind:text layer}
tell text object of art layer 1 of current document
set {contents, size, stroke color} to {firstName, 30.0, {class:RGB hex color, hex value:"913b8e"}}
end tell
tell text object of art layer 2 of current document
set {contents, size, stroke color, position} to {lastName, 48.0, {class:RGB hex color, hex value:"339966"}, {3, 4}}
end tell
end tell
__________________
Space Corps Directive 34124 Last edited by kryten2; Mar 16, 2013 at 05:46 PM. |
||
|
|
0
|
|
|
#4 |
|
Lots of great information. I'm looking into it and I will let you know the results. Thanks for the push!
|
|
|
|
0
|
|
|
#5 |
|
Worked Perfectly
Well I have it working now. Now instead of asking for a dialog box can i just have a textedit file that it gets from.
Get line one of lastname.txt for example ? line 1: Last Name line 2: First Name Code:
set firstName to text returned of (display dialog "First Name" default answer "Bill" buttons {"OK"} default button 1)
set lastName to text returned of (display dialog "Last Name" default answer "Gates" buttons {"OK"} default button 1)
|
|
|
|
0
|
|
|
#6 |
|
get line from textedit. set as variable
Hello,
Is it possible to get a line from text edit and then set it as a variable in applescript. For example: Textedit Line One: Ran Line Two: Man applescript get contents of line one get contents of line two Set contents of line one as VERB Set contents of line two as NOUN Last edited by troyman11; Mar 18, 2013 at 07:41 PM. Reason: Applescript |
|
|
|
0
|
|
|
#7 |
|
Google search terms:
applescript read file Many of the search results will be tutorials, examples, or sample code. You can narrow the search results by adding the appropriate keyword to the search terms: tutorial, example, or sample. The AppleScript commands at the heart of file read/write can be found in the scripting dictionary of StandardAdditions. 1. Run AppleScript Editor.app. 2. Choose "Open Dictionary..." from the File menu. 3. Scroll down to "ScriptingAdditions.osax". ** 4. Open it. 5. Look under the "File Read/Write" heading. ** You may or may not see the ".osax" suffix. I always run with all extensions visible. |
|
|
|
0
|
|
|
#8 |
|
More than one way of doing this but you can try something like this :
Code:
-- Opens a choose file dialog to select your text file to read set theNames to (read (choose file) as «class utf8») set lastName to first paragraph of theNames set firstName to second paragraph of theNames
__________________
Space Corps Directive 34124 |
|
|
|
0
|
|
|
#9 | |
|
error
Quote:
for now im just display dialog lastname |
||
|
|
0
|
|
|
#10 |
|
A plain text file not a Rich Text File. Notice the \rtf.
__________________
Space Corps Directive 34124 |
|
|
|
0
|
|
|
#11 |
|
Thanks
figured it out as i was saving as a nonreadable utf file. shift command t then save as .txt did it for me. Thank You so much for all your help.
|
|
|
|
0
|
![]() |
|
«
Previous Thread
|
Next Thread
»
| Thread Tools | Search this Thread |
| Display Modes | |
|
|
All times are GMT -5. The time now is 12:48 PM.







Linear Mode
