2 Replies Latest reply on Jan 25, 2016 1:47 PM by foltman

    changeGrep - problem with changing properties

    foltman Level 1

      Hello world!

       

      I'm trying to figure out what is wrong with find/change mechanism in this sample code:

       

      1. // variables containing properties
      2. var strFindFormat = "pointSize = 10";
      3. var strChangeFormat = "pointSize = 15";
      4. // cleaning find/change window
      5. app.findGrepPreferences = app.changeGrepPreferences = null;
      6. app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;
      7. // seting up find/change dialog
      8. var findPref = "app.findGrepPreferences." + strFindFormat + ";";
      9. var changePref = "app.changeGrepPreferences." + strChangeFormat + ";";
      10. //  performing find/change operation
      11. app.activeDocument.changeGrep();
      12. // cleaning find/change window
      13. app.findGrepPreferences = app.changeGrepPreferences = null;
      14. app.findGrepPreferences = app.changeGrepPreferences = NothingEnum.nothing;

       

      When I'm executing script it shouts at me that "Error number:1. Error String: changeGrep. Line 14" etc.

      If indsted of using findPref and changePref variables I'm making just "app.findGrepPreferences.pointSize = 10;" and "app.chageGrepPreferences.pointSize = 15;" - it works fine.

      But I need those variables to pass argument from function, properties will be defined in other place.

       

      Any idea what's wrong? Where I'm making mistake?