🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.photoshop.scripting
6 messages
6 total messages Started by Pearl_Teeth Tue, 31 Mar 2009 16:27
moving sequential layers to to corresponding points
#47
Author: Pearl_Teeth
Date: Tue, 31 Mar 2009 16:27
18 lines
1438 bytes
Hi. I'm completely new to scripting and I would appreciate some help. I took a little look at applescript but I can't figure some things out.

I've taken a short video, converted the frames to PS layers (all in the same document), and trimmed the whole thing to just the center vertical line 1 pixel wide. I want to now take all of those layers and line them up in order. layer 1 would be at (1,0), layer 2 at (2,0), etc.

This is the thing that I made. I think I figured out the gist of it, but I'm getting mixed up in the syntax somewhere. all I'm getting is a "file/folder expected" error.

repeat with layernum from 1 to 100
tell application "Adobe Photoshop CS3"
activate
tell document "scripttry.psd"
tell layer layernum
translate layer layernum of document "scripttry.psd" delta x pixels layernum
end tell
end tell
end tell
end repeat

where am I going wrong?
Re: moving sequential layers to to corresponding points
#50
Author: Mark_Larsen
Date: Tue, 31 Mar 2009 18:50
14 lines
1510 bytes
Pearl Teeth, Im at home at the moment on a Leopard Mac so Im unable to test. But I can tell you that you "file/folder expected" error is due to the way in which you are referencing your target objects. You are talking to layer of layer of document of document.
This is off the top of my head but here goes�

tell application "Adobe Photoshop CS2" -- Target Photoshop Application Object
	activate -- Tell application object what to do
	tell document "scripttry.psd" -- Next Target Document Object
		resize canvas width (10 as pixels) anchor position middle left -- Tell document object what to do
		repeat with i from 2 to 10 -- Start loop
			tell layer i -- Next Target Layer Object
				translate delta x (i - 1) as pixels -- Tell layer object what to do
			end tell -- Target Layer Object
		end repeat -- End loop
	end tell -- Target Document Object
end tell -- Target Photoshop Application Object
Re: moving sequential layers to to corresponding points
#51
Author: Pearl_Teeth
Date: Tue, 31 Mar 2009 19:57
4 lines
944 bytes
Hi Mark, thanks for your help.
When I try your script as is, it gets hung up on resize canvas. it says it expects end of line after resize, but finds an identifier (canvas).

When I take out that whole section, as I can resize the canvas myself, it catches on 'tell layer i'. it expects end of line after layer, but finds an identifier (i)
Re: moving sequential layers to to corresponding points
#52
Author: Mark_Larsen
Date: Tue, 31 Mar 2009 20:27
10 lines
1189 bytes
This could well be a change in the way Photoshop expects the syntax in CS3 which I don't have so I could not say. In your original you could try removing:

layer layernum of document "scripttry.psd"

from line 6 as this is where you are addressing objects within objects.
Once inside a tell document block you do not need to include a ref to the doc
This is the same once inside the tell layer block no need to ref the layer
You only need to create a loop inside the doc object around the layers

I hope that makes more sense to you? I should be back on a Tiger Mac in the morning�
Re: moving sequential layers to to corresponding points
#53
Author: Mark_Larsen
Date: Tue, 31 Mar 2009 20:42
12 lines
1200 bytes
Here is another way that you may want to try

tell application "Adobe Photoshop CS2" -- Target Photoshop Application Object
	activate -- Tell application object what to do
	set ruler units of settings to pixel units
	tell document "scripttry.psd" -- Next Target Document Object
		resize canvas width 10 anchor position middle left -- Tell document object what to do
		repeat with i from 2 to 10 -- Start loop
			translate layer i delta x (i - 1) -- Tell layer object what to do
		end repeat -- End loop
	end tell -- Target Document Object
end tell -- Target Photoshop Application Object
Re: moving sequential layers to to corresponding points
#57
Author: Pearl_Teeth
Date: Thu, 02 Apr 2009 06:12
1 lines
680 bytes
Mark, Thanks so much. I took out the part in line 6. it worked. you're awesome.
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads