Read input parameters from a script file name


i asked in main illustrator forum hour ago, realized there separate forum script questions…so please forgive repetition.  sure newbie adobe javascript question, have looked time , cannot figure out answer. how read input parameters script file name? example, let’s want run script requires 3 variables input, rather prompting values wish read them script file name … e.g., file name might “myscript.js (my_variable1, my_variable2, my_variable2)” … variables real numbers. assume script name when run should …  myscript.js (10, 10, 100), how read these , assign these values var statement within script?

willis77019b wrote:

 

  • how read input parameters script file name?
  • for example, let’s want run script requires 3 variables input, rather prompting values wish read them script file name
  • e.g., file name might “myscript.js (my_variable1, my_variable2, my_variable2)” … variables real numbers.
  • so assume script name when run should myscript.js (10, 10, 100), how read these , assign these values var statement within script?

 

if understand properly, how this?

 

/* using file name like: myscript_10_50_100_.js following script snippet pull out numbers , make them variables */ var jsfile = new file($.filename); var scriptname = jsfile.name; alert("script file name"+"\r"+scriptname); var numbervars = scriptname.replace( /^\d+/g, ''); var variablearray = numbervars.split('_'); var var1 = variablearray[0]; var var2 = variablearray[1]; var var3 = variablearray[2]; alert("variables:"+"\r"+"var1 = "+var1+" , var2 = "+var2+" , var3 = "+var3); 


More discussions in Illustrator Scripting


adobe

Comments

Popular posts from this blog

Adobe Acrobat Pro , Terminal Server Use

Thread: transmission-daemon isn't playing nice: "409: Conflict"

Thread: gpg: Conflicting Commands