I need to put an ordinal date phrase in several positions in a document. I have managed to be able to get it to put the phrase on the top of the first page where I then go along and cut and paste it where I need it. But what I would like is to run the script and have it insert the text exactly where I want it to go in the document with out manually having to do it. Here is the script I am using which I basically got to work copying and fixing it so I could get an output. I am running extendscript on Adobe FrameMaker v12
// INSERTING THE VALUE OF A VARIABLE INTO A DOCUMENT THAT WAS CREATED IN SCRIPT
var m_names = new Array("January", "February", "March",
"April", "May", "June", "July", "August", "September",
"October", "November", "December");
var date = new Date();
//alert(date) //shows system date
var curr_date = date.getDate();
//alert(curr_date) //shows the day date
var sup = "";
if (curr_date == 1 || curr_date == 21 || curr_date ==31)
sup = "st";
else if (curr_date == 2 || curr_date == 22)
sup = "nd";
else if (curr_date == 3 || curr_date == 23)
sup = "rd";
sup = "th";
var curr_month = date.getMonth();
//alert(curr_month) //shows the month
var curr_year = date.getFullYear();
//alert(sup) //shows the suffix for the ordinal number of the day date
var NewordinalDate="the "+curr_date + sup + " day of "+m_names[curr_month] + ", " + curr_year
//alert(NewordinalDate) // shows the date phrase of the ordinal day with the date.
//here is an example of the output "the 22nd day of August, 2016 "
var doc= app.ActiveDoc;
var mainflow =doc.MainFlowInDoc;
var pgf = tframe.FirstPgf;
var tLoc=new TextLoc();//Create the text location objet
tLoc.obj=pgf; //make it a paragraph
tLoc.offset=25; //insert at the start of the paragraphs
doc.AddText(tLoc,(NewordinalDate)); //insert the variable into the document look at the in parenthasse
//make sure paragraph marker is present on the target page or a lot of object references will be undifined.
any insight or help with this would be immensely appreciated.
It is not clear to me exactly what you are trying to do, but I would be willing to have a short web meeting with you so I can see what you are trying to accomplish. I am sure I could give you some pointers. I am on US Eastern Standard Time. Thanks. -Rick
Thank you so much for answering my issue. I am trying to put an ordinal date phrase in several places in a document.
The phrase which I can get to come into s document if I run the above script will insert "the 9th day of November, 2016" at the very top of the document on the first page in FrameMaker v12. I need it to place the phrase throughout the document on multiple pages inside the document, usually the last page of the document. I don't know how to move the phrase through the pages and on to the exact location I need it. Unfortunately the place can change if I add or subtract a paragraph on a given page in the document.
I am in central time here in Dallas Texas. But will make time whenever you are willing.
Thanks for your consideration