Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Output date and Modified Date Scripting Question

Advisor ,
May 20, 2016 May 20, 2016

var contentsOfFrame = 

            doc.name+"\r"+ 

            getLogInUserName() +"\r"+ 

            getLocaleDateString() +"\r"+ 

            getDateModification() +"\r"+ // Whats the Coder for Date Modified?

            getOutputDate()+"\r"+ // Whats the code for Output date?

            getAppUserName(); 

I cannot find anywhere what the Modification Date and Output date should be.  Can you please help. 

TOPICS
Scripting
1.6K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , May 21, 2016 May 21, 2016
Translate
Community Expert ,
May 21, 2016 May 21, 2016

Try this website:

http://www.indesignjs.de/extendscriptAPI/indesign11/#VariableTypes.html

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
May 22, 2016 May 22, 2016

Thank you I'll try it Monday and let you know

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
May 23, 2016 May 23, 2016

Ok it works.  Kinda.  It places abunch of numbers in the Date Modified and Output area but i need it to convert those #'s into the acutal Time and date.  Just like the Save Date Shown below the File Name. the First number just under the Date is Date modified, and the one below that should be Output date.

Screen Shot 2016-05-23 at 12.07.34 PM.png

Here's how its coded.

var contentsOfFrame = 

            doc.name+"\r"+ 

         /* getLogInUserName() +"\r"+  */

            getLocaleDateString() +"\r"+ 

            VariableTypes.MODIFICATION_DATE_TYPE +"\r"+ // Whats the Coder for Date Modified?

            VariableTypes.OUTPUT_DATE_TYPE +"\r"+ // Whats the code for Output date?*/

            getAppUserName();

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 23, 2016 May 23, 2016
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
May 23, 2016 May 23, 2016

I already tried that script.  It adds some of the stuff i want but i want it to be automatic in every file we have done.  SO I've used another script and added the above script to my Startup Scripts folder so No matter who opens the File and saves it all this information is in there.  Without us having to make a separate text box and add our Text variables. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
May 23, 2016 May 23, 2016

I meant to put the other part of code not the one above.

var contentsOfFrame = 

            doc.name+"\r"+ 

            getLogInUserName() +"\r"+ 

            getLocaleDateString() +"\r"+ 

            VariableTypes.MODIFICATION_DATE_TYPE +"\r"+ // Why doesn't this work?  ANd how do i get it to work?

            VariableTypes.OUTPUT_DATE_TYPE  +"\r"+ // Why doesn't this work?  ANd how do i get it to work?

            getAppUserName();

I meant to ask these question on the second time i posted this code.  If you need the rest of the code to see let me know and i'll paste it all on here.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 23, 2016 May 23, 2016

Why this is not working:

You apply an enumerator instance as part of the contents of the text frame. And that is producing a string from a number.

Since JavaScript is weakly typed the number will be automatically converted to a string.

And finally this string is part of the contents of a text frame.

Yo can read about "weakly typed" , enumerations  and enumerators here:

Indiscripts :: Type your Code

An Enumerator is a special native object which converts itself into either a String or a Number depending on the context.

Indiscripts :: InDesign Scripting Forum Roundup #3

How do Enumerator Instances Mimick Numbers

Indiscripts :: InDesign Scripting Forum Roundup #8

Regards,
Uwe

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 23, 2016 May 23, 2016

Here's another couple of links, both links are relevant so don't get put off by the titles

Re: How do I get ID ME (Middle Eastern) to display strings right-to-left?

and

Re: How can I create a running header?

HTH

Trevor

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
May 23, 2016 May 23, 2016

I've tried about 10 different strings and Variables infront of The MOD date and OUTput date and it still shows up those numbers above  Any other ideas?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
May 24, 2016 May 24, 2016

Ok so whats going on is that the Actual Value is working and being placed in the Text frame.  I just need to now tell the script what the value should be translated to?  Because when i get this to show those numbers they are the actual value's shown for that command.  however i'm not telling the script how to translate it. is my thinking correct?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
May 24, 2016 May 24, 2016

The fact of the matter you have to remember 2 points.

Uwe's links explain why.

  1. textVar = ip[-1].textVariableInstances.add(LocationOptions.AFTER, ip[-1]) 
  2. textVar.associatedTextVariable = doc.textVariables.itemByName("Creation Date"); 

Got it working?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
May 24, 2016 May 24, 2016

I'm messing with it now.  I'm trying to figure where to place those lines.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
May 24, 2016 May 24, 2016

Not sure what i did wrong.  A few min's ago i had it where it added the variable to my Type>Text Variables menu.  That's not where i'm wanting it. did i place the code in the wrong place.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
May 24, 2016 May 24, 2016

I'm gonna start another thread about this because The Original question was actually answered.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
May 27, 2016 May 27, 2016

No i cannot figure this out.  I've tried everything.  Is there another command without using text variables that will show output date and Date created?  This script has me whooped.  I just need 2 things and i think it will be done.   

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
May 27, 2016 May 27, 2016
LATEST

Here's what i have and i'm stuck

Part one.

var contentsOfFrame = 

        doc.name+"\r"+  //Working

        getLogInUserName() +"\r"+  //Working

        getLocaleDateString() +"\r"+  //Working

       

//-------------------->This is the Part that i cannot get to work proper<---------------------\\ 

// this Will display the Current date but I still not get it to display the Date Created or Output.  Any help PLEASE will be awesome.

        getCreationDateString() +"\r"+ // NOT WORKING

       /* getOutPutDateString()+"\r"+ NOT CREATED YET*/

      

//--------------------> The "VariableTypes" <---------------------\\

function getCreationDateString() { 

   

    var myVar;

        myVar = doc.textVariables.add();

        myVar.VariableType=VariableTypes.CREATION_DATE_TYPE;

    var Save_Information = Save_InformationTextFrame;

        Save_InformaionTextVar.associatedTextVariable= myVar;

   

        /*return Date(' Created ').toString();*/

    }

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
May 24, 2016 May 24, 2016

I created a new post as stated above for the second part of my question. here Cannot get the Date modified and Output to work correctly

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines