Re: How to convert Photoshop Javascript to applescript?
Re: How to convert Photoshop Javascript to applescript?
- Subject: Re: How to convert Photoshop Javascript to applescript?
- From: Stan Cleveland <email@hidden>
- Date: Tue, 15 Jan 2008 12:58:38 -0800
- Thread-topic: How to convert Photoshop Javascript to applescript?
On 1/15/08 12:32 PM, Patrik B. wrote:
> How do I convert the following Javascript for Photoshop cs3 extended into
> Applescript?
>
> var myopentexture71 = stringIDToTypeID( "open3DLayerTexture" );
> var myaction = new ActionDescriptor();
> var myopentexture72 = stringIDToTypeID( "textureIndex" );
> myaction.putInteger( myopentexture72, 4 );///the number 4 is the one that
> // changes
> executeAction( myopentexture71, myaction, DialogModes.NO );
>
> Or if not how do I pass a value from applescript to line 4 of the javascript?
>
> I currently run the above using
>
> set opentexture to alias "pathtothescript:opentexture.js"
>
> Tell app "Adobe Photoshop cs3"
> do javascript(opentexture)
> end
Patrik, probably the simplest method is to treat the javascript code as a
string, rather than a .js file and then use concatenation to insert the
desired value. I think this should work:
set myNum to 4 -- or whatever
tell application "Adobe Photoshop CS3"
do javascript ("function openTexture()
{
var myopentexture71 = stringIDToTypeID( \"open3DLayerTexture\" );
var myaction = new ActionDescriptor();
var myopentexture72 = stringIDToTypeID( \"textureIndex\" );
myaction.putInteger( myopentexture72, " & myNum & " );
executeAction( myopentexture71, myaction, DialogModes.NO );
}
openTexture( );")
end tell
Stan C.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden