Skip navigation
JohnAnt185
Currently Being Moderated

Launch extension using javascript

May 9, 2012 3:41 AM

Hello there...

 

I want to launch the extension (menu>Windows>Extensions) using javascript. Please suggest me a way to do this.

 

Thanks in advance.

 
Replies
  • Currently Being Moderated
    May 9, 2012 5:03 AM   in reply to JohnAnt185

    Check out this page.

    For example, the following line opens the Kuler extension:

    app.menuActions.itemByID(134503).invoke();
     
    |
    Mark as:
  • Currently Being Moderated
    May 9, 2012 7:15 AM   in reply to JohnAnt185

    I don't think you can speed up the process: there are more than 3000 menu items.

     
    |
    Mark as:
  • Currently Being Moderated
    May 10, 2012 4:22 AM   in reply to Kasyan Servetsky

    this script make a tabulated text file with the information of ids and names of all menu items.

     

     
    items=app.menuActions ;//.everyItem(); 
     info="title\tname\tid\n";
     for (t=0;t< app.menuActions.length;t++){
     
     info += items[t].title + "\t" +items[t].name + "\t" + items[t].id +"\n";
     }
     saveTxt(info,"demo.txt")
    function saveTxt(text,file){
                        file = new File(file);
                        file.encoding = "UTF-8";
                        file.open("w");
                        file.write(text); 
                        file.close();
                         file.execute();     
    } 
    
    
     
    |
    Mark as:
  • Currently Being Moderated
    May 10, 2012 4:26 AM   in reply to Kasyan Servetsky

    VERY bad idea to use ids for launching CS Extensions.

     

    The ids for CS Extensions are trnsient and can be different on different machines.

     

    Your id launches a totally different extension on my machine.

     

    You can try using the menu name instead of the id.

     
    |
    Mark as:
  • Currently Being Moderated
    May 10, 2012 5:32 AM   in reply to Harbs.

    I totally agree with you, Harbs. Thanks for pointing this out.

    app.menuActions.itemByName("Kuler").invoke();

    Referencing by name is much more reliable.

     
    |
    Mark as:
  • Currently Being Moderated
    May 10, 2012 5:40 AM   in reply to Kasyan Servetsky

    Of course that assumes there's no duplicate names...

     

    Harbs

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points