You Need To Save Me !!!!

Hey Everyone,

I haven’t post for a while, been working out a lot lately…

I Have a big request but i really need it as soon as possible (just understood ASAP…)
I’m working for a fashion photographer who used to be on CS4 and Leopard, he recently switch to Lion and CS5…

Anyway i did a lot of applescripting for him (im not a programmer at all so applescript even if it is’nt the cleanest way to code was the easier. But the CS5 does’nt work properly with AS… but i’m not at all into Javascripting…
So my request is can anyone translate this to JS or is there a tool (maybe asking much) to translate AS to JS…

This script is mainly for archiving pictures
here it is:

set Image_Folder to choose folder with prompt "Choisissez dossier pour SELECT PHOTOS" without invisibles
--
tell application "Finder"
	set Image_List to files in Image_Folder
	set Image_Count to count of every file in folder Image_Folder
end tell

tell application "Adobe Photoshop CS4"
	activate
	set display dialogs to never
	set Temp_Horizontal to make new document at beginning with properties ¬
		{mode:RGB, height:2147 as pixels, width:2953 as pixels, resolution:300 as pixels, initial fill:transparent}
	set Temp_Vertical to make new document at beginning with properties ¬
		{mode:RGB, height:2953 as pixels, width:2147 as pixels, resolution:300 as pixels, initial fill:transparent}
end tell


repeat with i from 1 to Image_Count
	tell application "Finder"
		set This_Image to file i of Image_Folder as alias
	end tell
	tell application "Adobe Photoshop CS4"
		activate
		try
			open This_Image
			set foreground color to {class:CMYK color, cyan:100, magenta:100, yellow:100, black:100}
			set background color to {class:CMYK color, cyan:0, magenta:0, yellow:0, black:0}
		on error
			display dialog "Over"
			return false
		end try
		set Image_Doc to current document
		tell Image_Doc
			make new art layer at beginning with properties ¬
				{name:"Flattener"}
			flatten
			set Image_Name to name
			set Trimmed_Name to text items 5 thru 8 of Image_Name as text
			if height is greater than width then
				set layo to duplicate layer 1
				resize image height 2746 as pixels
				resize canvas width 2147 as pixels height 2953 as pixels
				resize image height 2953 as pixels width 2147 as pixels resolution 300 as pixels
				
				set Temp_Set to make new layer set at end with properties ¬
					{name:Trimmed_Name}
				set Temp_Layer to make new art layer at end of Temp_Set with properties ¬
					{name:Trimmed_Name}
				select all
				fill selection with contents {class:RGB color, red:255, green:255, blue:255}
				deselect
				set layoliv to duplicate layo to beginning of last layer set
				set name of layoliv to Trimmed_Name
				set Text_Layer to make new art layer at beginning of Temp_Set with properties ¬
					{kind:text layer}
				set Text_Item to text object of Text_Layer
				set justification of Text_Item to center
				set font of Text_Item to "HelveticaNeue-Light"
				set size of Text_Item to 24 as points
				set stroke color of Text_Item to {class:RGB color, red:0, green:0, blue:0}
				set position of contents of Text_Item to {1073 as pixels, 2931 as pixels}
				set contents of contents of Text_Item to Trimmed_Name
				duplicate layer set 1 to beginning of Temp_Vertical
				close without saving
			else if width is greater than height then
				set layo to duplicate layer 1
				resize image height 1830 as pixels
				resize canvas width 2953 as pixels height 2147 as pixels
				resize image height 2147 as pixels width 2953 as pixels resolution 300 as pixels
				
				set Temp_Set to make new layer set at end with properties ¬
					{name:Trimmed_Name}
				set Temp_Layer to make new art layer at end of Temp_Set with properties ¬
					{name:Trimmed_Name}
				select all
				fill selection with contents {class:RGB color, red:255, green:255, blue:255}
				deselect
				set layoliv to duplicate layo to beginning of last layer set
				set name of layoliv to Trimmed_Name
				set Text_Layer to make new art layer at beginning of Temp_Set with properties ¬
					{kind:text layer}
				set Text_Item to text object of Text_Layer
				set justification of Text_Item to center
				set font of Text_Item to "HelveticaNeue-Light"
				set size of Text_Item to 24 as points
				set stroke color of Text_Item to {class:RGB color, red:0, green:0, blue:0}
				set position of contents of Text_Item to {1476 as pixels, 2102 as pixels}
				set contents of contents of Text_Item to Trimmed_Name
				duplicate layer set 1 to beginning of Temp_Horizontal
				close without saving
			end if
			
			
			
			
		end tell
		
	end tell
	
end repeat

If needed i can show a video of it in use so you understand what it does…

Hi Boldinger

I’m not sure exactly what you want your script to do, but I tried with CS5.1 and found errors with the way files are opened. A quick bit of investigation changing the input to files rather than folders gets the script to work.

Hope this helps

set These_Images to choose file with prompt "Choisissez dossier pour SELECT PHOTOS" with multiple selections allowed without invisibles
--

tell application "Adobe Photoshop CS5.1"
	activate
	set display dialogs to never
	set Temp_Horizontal to make new document at beginning with properties ¬
		{mode:RGB, height:2147 as pixels, width:2953 as pixels, resolution:300 as pixels, initial fill:transparent}
	set Temp_Vertical to make new document at beginning with properties ¬
		{mode:RGB, height:2953 as pixels, width:2147 as pixels, resolution:300 as pixels, initial fill:transparent}
end tell


repeat with This_Image in These_Images
	
	tell application "Adobe Photoshop CS5.1"
		activate
		try
			open This_Image
			set foreground color to {class:CMYK color, cyan:100, magenta:100, yellow:100, black:100}
			set background color to {class:CMYK color, cyan:0, magenta:0, yellow:0, black:0}
		on error
			display dialog "Over"
			return false
		end try
		set Image_Doc to current document
		tell Image_Doc
			make new art layer at beginning with properties ¬
				{name:"Flattener"}
			flatten
			set Image_Name to name
			set Trimmed_Name to text items 5 thru 8 of Image_Name as text
			if height is greater than width then
				set layo to duplicate layer 1
				resize image height 2746 as pixels
				resize canvas width 2147 as pixels height 2953 as pixels
				resize image height 2953 as pixels width 2147 as pixels resolution 300 as pixels
				
				set Temp_Set to make new layer set at end with properties ¬
					{name:Trimmed_Name}
				set Temp_Layer to make new art layer at end of Temp_Set with properties ¬
					{name:Trimmed_Name}
				select all
				fill selection with contents {class:RGB color, red:255, green:255, blue:255}
				deselect
				set layoliv to duplicate layo to beginning of last layer set
				set name of layoliv to Trimmed_Name
				set Text_Layer to make new art layer at beginning of Temp_Set with properties ¬
					{kind:text layer}
				set Text_Item to text object of Text_Layer
				set justification of Text_Item to center
				set font of Text_Item to "HelveticaNeue-Light"
				set size of Text_Item to 24 as points
				set stroke color of Text_Item to {class:RGB color, red:0, green:0, blue:0}
				set position of contents of Text_Item to {1073 as pixels, 2931 as pixels}
				set contents of contents of Text_Item to Trimmed_Name
				duplicate layer set 1 to beginning of Temp_Vertical
				close without saving
			else if width is greater than height then
				set layo to duplicate layer 1
				resize image height 1830 as pixels
				resize canvas width 2953 as pixels height 2147 as pixels
				resize image height 2147 as pixels width 2953 as pixels resolution 300 as pixels
				
				set Temp_Set to make new layer set at end with properties ¬
					{name:Trimmed_Name}
				set Temp_Layer to make new art layer at end of Temp_Set with properties ¬
					{name:Trimmed_Name}
				select all
				fill selection with contents {class:RGB color, red:255, green:255, blue:255}
				deselect
				set layoliv to duplicate layo to beginning of last layer set
				set name of layoliv to Trimmed_Name
				set Text_Layer to make new art layer at beginning of Temp_Set with properties ¬
					{kind:text layer}
				set Text_Item to text object of Text_Layer
				set justification of Text_Item to center
				set font of Text_Item to "HelveticaNeue-Light"
				set size of Text_Item to 24 as points
				set stroke color of Text_Item to {class:RGB color, red:0, green:0, blue:0}
				set position of contents of Text_Item to {1476 as pixels, 2102 as pixels}
				set contents of contents of Text_Item to Trimmed_Name
				duplicate layer set 1 to beginning of Temp_Horizontal
				close without saving
			end if
			
			
			
			
		end tell
		
	end tell
	
end repeat

Model: 2 x 2.8 GHz Quad-Core Intel Xeon
AppleScript: 2.1.2
Browser: Firefox 3.6.14
Operating System: Mac OS X (10.6)

Hello divster,

Actually for strange reasons, applescripts are really unstable on my system and the code i gave you does’nt work on my mac, it found errors about the display dialogs… strange,
anyway the purpose will be to easly convert it to Javascript but i don’t know this coding at all…

hope someone can help:rolleyes:

here is a video explaining the script:
http://vimeo.com/32575372