What is the applescript code that 'calls a javascript?

I am trying to ‘call’ (I believe this is the term) a javascript called Convert.PDF from applescript. This is the file path from terminal
/Applications/Adobe Photoshop 7/Presets/Scripts/ConvertPDF.js
How do I write this code in applescript?

Use the do javascript command in the Photoshop dictionary.

tell app "Adobe Photoshop 7"
  do javascript "Your Disk:Applications:Adobe Photoshop 7:Presets:Scripts:ConvertPDF.js"
end tell

I have tried using your script and for some reason it’s not working. I keep getting this error
Adobe Photoshop 7.0 got an error:
Error 25: Expected: ;.Line: 1-> Mac HD:Applications:Adobe Photoshop 7.0:Presets:Scripts:ConvertPDF.js
What does this mean and what am I doing wrong. Assume nothing about my knowldege of applescript since I am in the process of learning.
The script works thru photoshop. I just can’t get it to run from applescript.

This is the javascript generated by photshop:

var id5 = charIDToTypeID( "Ply " );
var desc2 = new ActionDescriptor();
var id6 = charIDToTypeID( “null” );
var ref1 = new ActionReference();
var id7 = charIDToTypeID( “Actn” );
ref1.putName( id7, “Convert to PDF” );
var id8 = charIDToTypeID( “ASet” );
ref1.putName( id8, “personal.atn” );
desc2.putReference( id6, ref1 );
executeAction( id5, desc2, DialogModes.NO );

Sorry, my mistake. This error message means that it expected a line of Javascript and what it found was a string that contained this: “Mac HD:Applications:Adobe Photoshop 7.0:Presets:Scripts:ConvertPDF.js”. Which isn’t JScript.
Don’t despair, you have just fallen into a trap which we have all found ourselves, like me in the message above. When you are referencing a file, you must specify that it is a file by saying “as alias”, i.e., a pointer to the actual file. Try this:

set scripttoRun to "MacHD:Applications:Adobe Photoshop 7.0:Presets:Scripts:ConvertPDF.js" as alias
tell app "Adobe Photoshop 7.0"
      do javascript scripttoRun
end tell

Works in Photoshop, because Pshop knows that it’s a script file and not a line of script, it’s coded into Pshop. Applescript is a generalist, it needs to be told.

So how is a JavaScript run within a script? Does one use;

do javascript “put the JavaScript code between the quote marks”

Very astute of you :o

See section 3.6.2 of the PS 7.0 Scripting Guide.

I suppose I should have also asked will this work in another application besides PhotoShop?

We’re talking PhotoShop I believe and I just tried do javascript in a script to work with Acrobat and it didn’t work and I got a sytax error message.

Well I finally did get it to work. Using do script instead of do javascript that is.