I had a script that has worked perfectly for a couple of years on 10.4…
I have just upgraded to 10.5 and guess what…
Basically the script process images that are imbedded in folders into a new size and another folder.
The script fails on an open alias command.
tell application “Adobe Photoshop CS3”
open alias “firewire baby:RHODES:Test:Abigail Salter_NG3082:Original Files:5NG3082ABER.JPG”
“Adobe Photoshop CS3 got an error: Scripting component error.”
I wrote a cut down version of the script leaving out some image events processes and this worked fine!?
set Pathtoprocess to alias "Whopper:Users:johnclark:Documents:WORK:GROUP PROCESS:Process Folder:"
set PathtoprocessCS to alias "Whopper:Users:johnclark:Documents:WORK:GROUP PROCESS:Process Folder CS:"
display dialog "Do you want the images to be in colour or greyscale" buttons {"Colour", "Greyscale"}
set colourmode to button returned of the result
choose folder with prompt "Choose folder from which to process images"
set Pathtoclients to result
choose folder with prompt "Choose folder to put processed folders" default location alias "Whopper:Users:johnclark:Documents:WORK:GROUP PROCESS:GROUP To BURN_BOOTS:"
set Pathtoburn to result
global Pathtoburn
set clientlist to list folder Pathtoclients without invisibles
repeat with i from 1 to the number of items in clientlist
set thisclient to item i of clientlist as Unicode text
set imagefolder to alias (Pathtoclients & thisclient & ":Original Files:" as Unicode text)
set I_mages to list folder imagefolder without invisibles
if colourmode = "Greyscale" then
repeat with i from 1 to (length of I_mages)
set thisimage to item i of I_mages
set image_file_path to (imagefolder & thisimage as Unicode text)
C_onvertoGREY(image_file_path)
end repeat
end if
end repeat
on C_onvertoGREY(image_file_path)
with timeout of 3000 seconds
tell application "Adobe Photoshop CS3"
--activate
open alias image_file_path
set x to width of document 1
set y to height of document 1
if x is greater than y then
rotate canvas document 1 angle -90
do action "convert greyscale" from "Group Clients_new.atn"
else
do action "convert greyscale" from "Group Clients_new.atn"
end if
end tell
end timeout
end C_onvertoGREY
I got the original script to work yesterday by adding a activate command after the CS3 tell block… but today it refuses to go past this point
The Script editor message is of the “Scripting component error” type
At a quick guess I would say your passing your photoshop handler a string and its expecting alias try changing “open alias image_file_path” to open image_file_path as alias
Thanks for that but I had already tried pretty much every variation of alias
I am going to post both the cut down script and the entire script, The cut down script WORKS. The main script does not. I am only choosing GREYSCALE to activate the handler C_onvertoGREY.
Perhaps you can spot something that is evading me…
The CUT DOWN SCRIPT THAT WORKS
set Pathtoprocess to alias "Whopper:Users:johnclark:Documents:WORK:GROUP PROCESS:Process Folder:"
set PathtoprocessCS to alias "Whopper:Users:johnclark:Documents:WORK:GROUP PROCESS:Process Folder CS:"
display dialog "Do you want the images to be in colour or greyscale" buttons {"Colour", "Greyscale"}
set colourmode to button returned of the result
choose folder with prompt "Choose folder from which to process images" default location alias "Whopper:Users:johnclark:Desktop:Test:"
set Pathtoclients to result
choose folder with prompt "Choose folder to put processed folders" default location alias "Whopper:Users:johnclark:Documents:WORK:GROUP PROCESS:GROUP To BURN_BOOTS:"
set Pathtoburn to result
global Pathtoburn
set clientlist to list folder Pathtoclients without invisibles
repeat with i from 1 to the number of items in clientlist
set thisclient to item i of clientlist as Unicode text
set imagefolder to alias (Pathtoclients & thisclient & ":Original Files:" as Unicode text)
set I_mages to list folder imagefolder without invisibles
if colourmode = "Greyscale" then
repeat with i from 1 to (length of I_mages)
set thisimage to item i of I_mages
set image_file_path to (imagefolder & thisimage as Unicode text as alias)
C_onvertoGREY(image_file_path)
end repeat
end if
end repeat
on C_onvertoGREY(image_file_path)
with timeout of 3000 seconds
tell application "Adobe Photoshop CS3"
--activate
open image_file_path
set x to width of document 1
set y to height of document 1
if x is greater than y then
rotate canvas document 1 angle -90
do action "convert greyscale" from "Group Clients_new.atn"
else
do action "convert greyscale" from "Group Clients_new.atn"
end if
end tell
end timeout
end C_onvertoGREY
THE FULL SCRIPT THAT ERRORS OUT AT THE HANDLER C_onvertoGREY WITH ERROR
open alias “Whopper:Users:johnclark:Desktop:Test:Abigail Salter_NG3082:Original Files:1NG3082ABER.JPG”
“Adobe Photoshop CS3 got an error: Scripting component error.”
THIS ALSO BOMBS CS3 WHICH HAS TO BE FORCED TO QUIT BECAUSE THE ERROR DIALOG BOX KEEPS RE APPEARING AFTER "OK’ IS PRESSED
set Pathtoprocess to alias "Whopper:Users:johnclark:Documents:WORK:GROUP PROCESS:Process Folder:"
set PathtoprocessCS to alias "Whopper:Users:johnclark:Documents:WORK:GROUP PROCESS:Process Folder CS:"
set LOGO to alias "Whopper:Users:johnclark:Library:PhotoData:Logo:John Clark Photographic.jpg"
display dialog "Do you want the images to be in colour or greyscale" buttons {"Colour", "Greyscale"}
set colourmode to button returned of the result
choose folder with prompt "Choose folder from which to process images" default location alias "Whopper:Users:johnclark:Desktop:Test:"
set Pathtoclients to result
choose folder with prompt "Choose folder to put processed folders" default location alias "Whopper:Users:johnclark:Documents:WORK:GROUP PROCESS:GROUP To BURN_BOOTS:"
set Pathtoburn to result
global Pathtoburn
set clientlist to list folder Pathtoclients without invisibles
tell me to activate
repeat with i from 1 to the number of items in clientlist
set thisclient to item i of clientlist as Unicode text
set folderlist to {thisclient}
FOLDERMAKER(Pathtoprocess, folderlist)
tell application "Finder"
duplicate LOGO to PathtoprocessCS with replacing
set LOGOpath to alias (PathtoprocessCS & "John Clark Photographic" as Unicode text)
set name of LOGOpath to thisclient
end tell
set imagefolder to alias (Pathtoclients & thisclient & ":Original Files:" as Unicode text)
set I_mages to list folder imagefolder without invisibles
repeat with i from 1 to (length of I_mages)
set thisimage to item i of I_mages
set image_file_path to (imagefolder & thisimage as Unicode text)
set pixelsize to 650
changeimagesize(image_file_path, pixelsize, PathtoprocessCS)
end repeat
C_ontact()
assemble_fuji(thisclient, PathtoprocessCS, Pathtoprocess)
if colourmode = "Greyscale" then
repeat with i from 1 to (length of I_mages)
set thisimage to item i of I_mages
set image_file_path to (imagefolder & thisimage as Unicode text as alias)
C_onvertoGREY(image_file_path)
end repeat
end if
if colourmode = "Colour" then
repeat with i from 1 to (length of I_mages)
set thisimage to item i of I_mages
set image_file_path to (imagefolder & thisimage as Unicode text as alias)
C_onvertoRGB(image_file_path)
end repeat
end if
tell application "Finder"
move every file of PathtoprocessCS to alias (Pathtoprocess & thisclient & ":" as Unicode text)
move folder thisclient of folder Pathtoprocess to folder Pathtoburn
end tell
end repeat
display dialog "All folders are processed"
on C_onvertoGREY(image_file_path)
with timeout of 3000 seconds
tell application "Adobe Photoshop CS3"
--activate
open image_file_path
set x to width of document 1
set y to height of document 1
if x is greater than y then
rotate canvas document 1 angle -90
do action "convert greyscale" from "Group Clients_new.atn"
else
do action "convert greyscale" from "Group Clients_new.atn"
end if
end tell
end timeout
end C_onvertoGREY
on C_onvertoRGB(image_file_path)
with timeout of 3000 seconds
tell application "Adobe Photoshop CS3"
activate
open image_file_path
set x to width of document 1
set y to height of document 1
if x is greater than y then
rotate canvas document 1 angle -90
do action "RGB only" from "Group Clients_new.atn"
else
do action "RGB only" from "Group Clients_new.atn"
end if
end tell
end timeout
end C_onvertoRGB
on assemble_fuji(thisclient, PathtoprocessCS, Pathtoprocess)
tell application "Finder"
delete file thisclient of folder PathtoprocessCS
set n_ame to (thisclient & ".jpg" as Unicode text)
--set x to (PathtoprocessCS & "ContactSheet-001.jpg" as Unicode text as alias)
set name of file (PathtoprocessCS & "ContactSheet-001.jpg" as Unicode text) to n_ame
--set name of file x to n_ame
move file n_ame of PathtoprocessCS to alias (Pathtoprocess & thisclient & ":" as Unicode text)
delete every file of PathtoprocessCS
--move folder thisclient of folder Pathtoprocess to folder Pathtoburn
end tell
end assemble_fuji
on C_ontact()
tell application "Adobe Photoshop CS3"
--activate
with timeout of 240 seconds
do action "group_contact sheet" from "Group Clients_new.atn"
end timeout
end tell
end C_ontact
on changeimagesize(image_file_path, pixelsize, savepath)
tell application "Image Events"
launch
set theimage to open file image_file_path
scale theimage to size pixelsize
tell theimage
set {x, y} to dimensions of theimage
if x < y then
rotate theimage to angle -90
end if
set {x, y} to dimensions of theimage
end tell
save theimage in savepath
close theimage
end tell
end changeimagesize
on FOLDERMAKER(p_ath, folderlist)
repeat with i from 1 to number of items in folderlist
set foldername to item i of folderlist
try
tell application "Finder"
make new folder at p_ath with properties {name:foldername}
end tell
on error the error_message number the error_number
display dialog "Error: " & the error_number & ". " & the error_message buttons {"Cancel"} default button 1
end try
end repeat
end FOLDERMAKER
on rotateimage(image_file_path)
tell application "Image Events"
launch
set theimage to open file image_file_path
tell theimage
set {x, y} to dimensions of theimage
if x < y then
rotate theimage to angle -90
save theimage in image_file_path
end if
set {x, y} to dimensions of theimage
end tell
close theimage
return {x, y}
end tell
end rotateimage
:rolleyes: After a reboot it all worked fine…Sorry chaps for wasting your time…embarrassed… yes…impressed with Leopard…not at the moment… to many niggles