In article <1gyhro1.10jiox31rqqmumN%bpesenti_pala@mac.com>, Bruno
<bpesenti_pala.DeleteThis@mac.com> wrote:
> I would open an image with photoshop and do some action.
>
> I try this 2 scripts:
>
> set the topLevelFolder to (choose folder) as string
> tell application "Finder"
> set fileList to name of every file of folder topLevelFolder as
> list
> end tell
> repeat with oneFile in fileList
> set oneFile to oneFile as string
>
> set theFile to topLevelFolder & oneFile
> tell application "Adobe Photoshop CS"
> open theFile
> do script "save action"
> end tell
> end repeat
>
> This script give an error "Photoshop don't know open message"
> (in french: Erreur dans Adobe Photoshop CS :
> "Calvin:Users:calvin:Desktop:script:CRW_1381.jpg" ne comprend pas le
> message open.)
>
I can't cover the Photoshop "do script" but here's what is happening
with the rest of your script.
In the first line you convert an alias to a string, this conversion
isn't needed.
In the Finder "tell", you don't need to get the name, what you want is
an alias to each file.
In the repeat loop you are telling PhotoShop to open a string which it
can not do. This is a trap we've all fallen into.
Assuming your Photoshop action works correctly, this should work for
what you are attempting.
--> cut <--
set the topLevelFolder to (choose folder)
tell application "Finder"
set fileList to every file of folder topLevelFolder
end tell
tell application "Adobe Photoshop CS"
repeat with oneFile in fileList
open (contents of oneFile)
do script "save action"
end repeat
end tell
--> cut <--
> on run
> set theFolder to choose folder
> openImages(theFolder)
> end run
>
> on open {theFolderItems}
> openImages(theFolderItems)
> end open
>
> on openImages(theFolder)
> tell application "Finder"
> set itemList to files in theFolder
> repeat with an_item in itemList
> tell application "Adobe Photoshop CS"
> activate
>
> open an_item
> -- put your actions / scripts here
> -- do script "page1"
> end tell
> end repeat
> end tell
> end openImages
>
> This script open the image with Preview
>
> What's wrong ?
You have the Photoshop "tell" within a Finder "tell", the script is
confused. Try this instead.
--> cut <--
on run
set theFolder to choose folder
openImages(theFolder)
end run
on open {theFolderItems}
openImages(theFolderItems)
end open
on openImages(theFolder)
tell application "Finder"
set itemList to files in theFolder
end tell
repeat with an_item in itemList
tell application "Adobe Photoshop CS"
activate
open (contents of an_item)
-- put your actions / scripts here
-- do script "page1"
end tell
end repeat
end openImages
--> cut <--
--
Use ROT-13 on the email address for email replies