Thank you both once again. sorry about the tardiness of my reply, by we in Oz had to sleep.
Try67, I modified my script, but still get an error 'Can't understand script message', and a debug error (below)
Test Screen Name, here's the result of my Debug. I don't know what the missing ';' really wants? I've tried putting a ';' & return in front, and now the debugger does not throw an error, but it also doesn't work. The 'run' button stays red
var f = this.addField("Text1","Ñthis is a testÓ", [0, 1298, 144, 1262], 0);
f.richText:true;
f.textSize:16;
f.alignment:"Left";
f.multiline:false;
f.lineWidth:0;
f.display:display.visible;
f.textColor:color.black;
SyntaxError: missing ; before statement
1:
SyntaxError: missing ; before statement
1:
My Code...
tell application "Adobe Acrobat"
activate
set p to 1
tell document 1
tell page 1
set cbox to {}
if cbox = {} then set cbox to crop box
if cbox = {} then set cbox to bounds
if cbox = {} then set cbox to media box
if cbox = {} then set cbox to art box
if cbox = {} then set cbox to trim box
if cbox = {} then set cbox to bleed box
set p to 4
set pageTop to (item 2 of cbox) + 36 as integer
set p to 5
set item 2 of cbox to pageTop
set p to 6
set pageBottom to (item 4 of cbox)
set p to 7
set item 4 of cbox to pageBottom
set p to 8
set bounds to cbox
set p to 9
set media box to cbox
set p to 10
set crop box to cbox
set p to 11
set trim box to cbox
set p to 12
set bleed box to cbox
set p to 13
set art box to cbox
set p to 14
set theNewString to ((character id 209) & "this is a test" & (character id 211) as text)
#
# values are Text, Font, Font Size, Start Page, End Page, Text type?, Horizontal Alignment, Vertical Offset, Horizontal Offset, Vertical Height, Rotation, Current Page
set p to 15
set theResult1 to my Add_TextBoxText(theNewString, "MRVCode128bXSA", 16, 1, 1, 1, 0, pageTop, 144, 36, 0, 1)
try
do script theResult1
on error errmsg
display dialog errmsg
end try
end tell
end tell
end tell
# This handler uses Java Script
#
on Add_TextBoxText(cText, cFont, nFontSize, nS, nE, nTA, nHorizontalAlignment, nVerticalAlignment, nHorizontalValue, nVerticalValue, nR, currentPage)
set Params to "var f = this.addField(\"" & "Text1" & "\",\"" & cText & "\", [" & nHorizontalAlignment & ", " & nVerticalAlignment & ", " & nHorizontalValue & ", " & nVerticalAlignment - nVerticalValue & "], " & currentPage - 1 & ");" & return
set Params to Params & "f.richText:true;" & return
# set Params to Params & "f.textFont:font.\"" & cFont & "\";" & return
set Params to Params & "f.textSize:" & nFontSize & ";" & return
set Params to Params & "f.alignment:\"" & "Left" & "\";" & return
set Params to Params & "f.multiline:false;" & return
set Params to Params & "f.lineWidth:0;" & return
set Params to Params & "f.display:display.visible;" & return
set Params to Params & "f.textColor:color.black;" & return
set javaScript to Params
set the clipboard to javaScript
return javaScript
end Add_TextBoxText
Added this to stop debugger throwing an error, but does not do anything now.
set Params to ";" & return
set Params to Params & "var f = this.addField(\"" & "Text1" & "\",\"" & cText & "\", [" & nHorizontalAlignment & ", " & nVerticalAlignment & ", " & nHorizontalValue & ", " & nVerticalAlignment - nVerticalValue & "], " & currentPage - 1 & ");" & return
Replace all colons with equals signs (=).
Also, double-check the order of the parameters of addField.