Photoshop Applescript fails , why?

Sivakatirswami katir at hindu.org
Thu Oct 28 23:21:05 EDT 2010


  I'm trying to drive some photoshop processes with Livecode.

The idea is small applescripts are easy, "bigger" file operations are 
easier done in LiveCode.

2 problems

ONE: Apple script dies in LiveCode, but runs in Script Editor.app why?

tell Application "Adobe Photoshop CS5"
   do action "merge leaves" from "Merge Leaves"
end tell

works from  Applescript Editor.app

I can also put this into a custom property

tell application "Adobe Photoshop CS5"
     activate
     do action "###Action###" from "###Set###"
end tell

and this in a button:

on mouseUp
    put the uMergeLeavesAScript of this stack into tScript
    replace "###Action###" with fld "Action Name" in tScript
    replace "###Set###" with fld "Action Set" in tScript
    do tScript as AppleScript
end mouseUp

If I test for my script with a "put" statement I get exactly what works 
in Applescript Editor.app

tell Application "Adobe Photoshop CS5"
   do action "merge leaves" from "Merge Leaves"
end tell

But Adobe Photoshop is not activated.

If I add this to the script:

tell application "Adobe Photoshop CS5"
     activate
     do action "###Action###" from "###Set###"
end tell

it still does not work

If I test just this:

tell application "Adobe Photoshop CS5"
     activate
end tell

it *does* work... so ... why does the applescript line

do action "merge leaves" from "Merge Leaves" when run from LiveCode

a) block the activation of photoshop b) thereby fail to run itself?

Any clues?

TWO: Run another program (via applescript) on a loop from inside LiveCode

then, once I do get it running, is it possible to have LiveCode run 
another application on a loop? once you activate another program.. and 
if the program takes many seconds to run the process, can LiveCode be 
told to wait and when activity stop in Photoshop, to go open the next 
two files?



on mouseUp
    put the uMergeLeavesAScript of this stack into tScript
    replace "###Action###" with fld "Action Name" in tScript
    replace "###Set###" with fld "Action Set" in tScript
    put fld "PhotoshopPath" into tPhotoShop
    put fld "FileDirectory" into tFolder
    set the defaultFolder to tFolder
    put the files into tFileList
    filter tFilelist with "*.JPG*"
    launch (tFolder&"/"& line 1 of tFileList) with tPhotoShop
    launch (tFolder&"/"& line 2 of tFileList) with tPhotoShop
    do tScript as AppleScript
    # put this in a loop to then go back and get the next set of files.
end mouseUp





More information about the use-livecode mailing list