json - Passing Applescript list to javascript ExtendScript as array for Indesign -


background

i have load of applescripts(as) designers use indesign process workflow production. there great deal of os interaction javascript can not, moving away not possible.

due restrictions unable install pretty anything. unable update anything. script editor , extendscript tool kit have work with.

operating environment: os x 10.8.5 & adobe cs6

how works

user preferences saved properties in local applescripts saved in user's documents folder.

    ###property grabber.scpt     set mypath path documents folder     set mypropertiesfile ((mypath & "myproperties.scpt") string)     set thepropertyscript load script file mypropertiesfile     set designerinitials (designerinitials of thepropertyscript)  etc... 

some of properties lists.

why need js?

i'm making palettes , prefer use scriptui rather in this:

set dlgref make dialog properties {name:"user settings", can cancel:true, label:"dialog label"}  

the string hands off js this:

{"myname",{firstvalue:"test", secondvalue:"val2", thirdvalue: "val3"},{firstvalue:"test2", secondvalue:"val2", thirdvalue: "val3"}} 

these not lists, text...

the js

myapplescript = new file("valid_path_to/property grabber.scpt"); var myreturn = app.doscript(myapplescript, scriptlanguage.applescriptlanguage); var myname = myreturn[0]; var firstlist = myreturn[1]; var secondlist = myreturn[2]; 

extendscript data browser shows:

 firstlist = {firstvalue:"test", secondvalue:"val2", thirdvalue: "val3"} 

it not array...

i have tried using https://github.com/kaylukas/applescript-json json encode lists, same result.

firstlist = [{firstvalue:"test", secondvalue:"val2", thirdvalue: "val3"}] 

i have made simpler

  firstlist = {"test","val2","val3"} 

still js treats string , not array.

any ideas need or doing wrong? hope simple , feel stupid if answer...

glad have works, if you're passing text extendscript, why not format on side extendscript-friendly, ['firstvalue', 'secondvalue', 'thirdvalue"'] --but string in as, like

--in as: "['firstvalue', 'secondvalue', 'thirdvalue"']" 

then, in extendscript, if that's in variable, like, mydata, can (as did in extendscript toolkit):

//in js: myarray = eval(mydata); 

i know using eval() evil in web work, extendscript stuff, can useful.


Comments

Popular posts from this blog

python - pip install -U PySide error -

arrays - C++ error: a brace-enclosed initializer is not allowed here before ‘{’ token -

cytoscape.js - How to add nodes to Dagre layout with Cytoscape -