Photoshop Applescript fails , why?

Terry Judd tsj at unimelb.edu.au
Thu Oct 28 23:36:22 EDT 2010


What happens if you use system events to activate Photoshop first and then
tell Photoshop to do its action?

tell application "System events" to tell application "Adobe Photoshop CS5"
to activate
tell application "Adobe Photoshop CS5" to do action [action] from [set]

Terry...

On 29/10/10 2:21 PM, "Sivakatirswami" <katir at hindu.org> wrote:

> 
>   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
> 
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution

--
Dr Terry Judd | Senior Lecturer in Medical Education
Medical Education Unit
Melbourne Medical School
The University of Melbourne





More information about the use-livecode mailing list