Hello i am workin on a script dat does a different action for each file based on their dimensions.
property SourceFolder : missing value
property destinationFolder : missing value
if SourceFolder = missing value then
set SourceFolder to (choose folder with prompt "Choose RGB:")
set destinationFolder to (choose folder with prompt "Choose JPG:")
else
tell application "Finder"
set theFolders to every item of entire contents of SourceFolder as list
repeat with thisFolder in theFolders
make new alias file at destinationFolder to thisFolder
end repeat
end tell
end if
tell application "Finder"
set filesList to (files of entire contents of SourceFolder whose name extension is "eps") as alias list
end tell
tell application "Adobe Photoshop CS6"
repeat with aFile in filesList
open aFile
set actionWord to (display dialog "Choose the size" buttons {"Large-475×277", "Medium-292×130", "Small-180×100"})'s button returned's word 1
tell document 1
do action "PP hoogte detail 5 cm" from "Formaten"
save it in file (destinationFolder & name) as JPG --assumes an HFS path
close
end tell
end repeat
end tell
But it fails set actionWord to (display dialog “Choose the size” buttons {“Large-475×277”, “Medium-292×130”, “Small-180×100”})'s button returned’s word 1 >> here i can only choose one action. no matter what button i push.
And i know i need a better code for the saving bit.
Model: Mac Pro 2010
AppleScript: 2.2.4
Browser: Chrome
Operating System: Mac OS X (10.8.5)
When it is not enclosed in a tell application “Photoshop” block, the display dialog instruction behaves flawlessly so it may be useful to edit it as :
tell application "SystemUIServer" to set actionWord to (display dialog "Choose the size" buttons {"Large-475×277", "Medium-292×130", "Small-180×100"})'s button returned's word 1
I’m a bit puzzled because the script creates the variable actionWord but doesn’t use it.
Yvan KOENIG running Yosemite 10.10.4 in French (VALLAURIS, France) mardi 28 juillet 2015 14:47:00
EDIT the save instruction need some change too
save it in file ((destinationFolder as text) & name) as JPG --assumes an HFS path
Of course you may coerce the destinationFolder into text before entering the loop but doing it here was (at least for me) the easiest way to point to the anomaly.
I would also edit an other instruction :
set theFolders to every folder of entire contents of SourceFolder as list
I, too, am puzzled, since the instruction given in the original thread that this code descends from is correct. The explicit direction in the code to use HFS paths, which, while preserved, was also ignored. Follow-up questions shouldn’t necessitate a new post.
http://macscripter.net/viewtopic.php?id=43840
My understanding of the original question was that whichever button was clicked, actionWord was set to the same value.
It seams that in fact the asker missed the fact that he don’t use the button clicked but an Hardcoded action.
It’s so foolish that I didn’t imagine that the problem was this one (of course I didn’t knew the other thread).
Yvan KOENIG running Yosemite 10.10.4 in French (VALLAURIS, France) mardi 28 juillet 2015 16:56:45