On
8/1/08 8:54 AM, "Oakley Masten" wrote:
> Ok
I feel pretty dumb here so Help!
>
>
Trying to use _javascript_ listener to do things with PhotoShop CS2.
> We
want to do several things that _javascript_ might help.
>
> I
recorded a _javascript_ and ask a friend who knows _javascript_ to help.
>
> We
can't figure out how to pass the path and file name to save the image in
>
from AppleScript to _javascript_.
>
>
Where do I start?
>
>
Does the path have to be POSIX or can I use HFS?
> If
POSIX do I format it with applescript and then pass
>
and if so what is the exact format?
>
>
Any help would be greatly appreciated
Oakley,
On Fri,
01 Aug 2008 13:34:19 -0700
Stan
Cleveland <email@hidden>
Wrote
Here is
a very brief intro using this demo snippet of _javascript_:
desc3.putPath( id30, new File( "/Users/omasten/Desktop" ) );
The
general steps to make listener-recorded _javascript_ usable in AppleScript
are:
1.
Paste the _javascript_ code into an AS editor window and put quote marks
around
it.
"desc3.putPath( id30, new File( "/Users/omasten/Desktop" )
);"
2.
Escape all quote marks within the _javascript_ with a backslash (\)
"desc3.putPath( id30, new File( \"/Users/omasten/Desktop\" )
);"
3.
Surround the quoted _javascript_ with 'tell' and 'do _javascript_' commands.
tell application "Adobe Photoshop CS2"
do _javascript_ "desc3.putPath( id30, new File(
\"/Users/omasten/Desktop\"
)
);"
end tell
4.
Replace hard-coded paths and settings values in the _javascript_ with
variables. (You'll need to carefully study the _javascript_ to identify
all of these.) Remember that the _javascript_ is a string, so inserting
a variable involves splitting the string and concatenating the
variable between the string segments. Yes, you must use POSIX paths.
set savePath to POSIX path of (path to desktop) as text
tell application "Adobe Photoshop CS3"
do _javascript_ "desc3.putPath( id30, new File( \"" & savePath
& "\" ) );"
end tell
Hope
that gives you enough information to get things going!
Stan C.
Thanks
Stan.
With
this we were able to get it working.
Not
done yet but actually working.
Oakley