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

howto run a script in the idle task

Guest
May 11, 2009 May 11, 2009

Hi all,

I successfully wrote and executed an idle task routine that periodically executes a simple method. now i need to add a functionality to that method so that it executes a simple javascript.

here is my code:

...

uint32 myTestIdleTask::RunTask(
    uint32 appFlags, IdleTimer* timeCheck) {
    if( appFlags &
        ( IIdleTaskMgr::kMouseTracking
        | IIdleTaskMgr::kUserActive
        | IIdleTaskMgr::kInBackground
        | IIdleTaskMgr::kMenuUp))
    {
        return kOnFlagChange;
    }

    this->runTestScript();

    return kmyTestFvExecInterval;
}


void myTestIdleTask::runTestScript() {

    // this is the test script

    PMString myTestScript("app.activeDocument.exportFile(ExportFormat.pdfType, File(\"/Users/testuser/testing.pdf\"),false);");

    // i think i need to call    CScriptRunner::RunScript()
   // somewhere here but no success

}

Any help on how to execute the myTestScript Javascript code from the runTestScript() method?

Thanks in advance,

Hakan

TOPICS
SDK
1.5K
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

Deleted User
May 11, 2009 May 11, 2009

I already solved my problem by using "IExtendScriptUtils".

For those who are interested here is my solution:

void myTestIdleTask::runTestScript() {

    // this is the test script

    PMString myTestScript("app.activeDocument.exportFile(ExportFormat.pdfType, File(\"/Users/testuser/testing.pdf\"),false);");

PMString engineName("myengine");

int32 errorCode=Utils<IExtendScriptUtils>()->RunScriptInEngine ( engineName, myTestScript);

}

Goodluck.

hakan

Translate
Participant ,
May 11, 2009 May 11, 2009

Dear Hakan

    

          I read your post, I'm really very happy to say, B'coz I'm also struggle to run the "JavaScript" through VC++ coding,

I need your help to run the below script.

Code:

     var myOs = getOs();

     alert(myOs);

     function getOs() { 
       if( $.os.substring(0, 7)=="Windows")
           {
                 myUser =  $.os;
                 return myUser; 
           }
        else if($.os.substring(0, 7)=="Mac Os")
         {
       myUser =  $.os;
        return myUser; 
  }

I'm checking the OS. How to invoke this in to VC++ or run through VC++ coding. I'm creating the project using dollyxs.bat file.

Kindly give me a guideline to run the above script & help me.

Thanks in advance

Regards

T.R.Harihara SudhaN

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
Guest
May 11, 2009 May 11, 2009

I already solved my problem by using "IExtendScriptUtils".

For those who are interested here is my solution:

void myTestIdleTask::runTestScript() {

    // this is the test script

    PMString myTestScript("app.activeDocument.exportFile(ExportFormat.pdfType, File(\"/Users/testuser/testing.pdf\"),false);");

PMString engineName("myengine");

int32 errorCode=Utils<IExtendScriptUtils>()->RunScriptInEngine ( engineName, myTestScript);

}

Goodluck.

hakan

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
Participant ,
May 12, 2009 May 12, 2009

Dear hakan

    I used the below coding [some slight modification], but this is not working............

    Thats the way I need the help from you.

    "For those who are interested here is my solution: "....

     Yes, I'm interesed to know how to run the script using VC++....

Thanks & Regards

T.R.Harihara SudhaN

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
Guest
May 12, 2009 May 12, 2009
LATEST

Sorry that I can't help you, because I am NOT coding for Microsoft platforms.

For the InDesign API part, as a starting point, from the SDK  you can search samples using "IStartupShutdownService" so that you can find a suitable functionality to execute your javascript code at startup. And at that point you can call a method similar to my runTestScript() method.

Good luck.

Hakan

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