[Javascript] read/write/remove custom environment variable for photoshop

I needed to store some variables like opened folder location in open dialog for photoshop script.
Currently I couldn’t find good native photoshop environment variable storing method yet so I decided to make my own.

readMyEnv(key) : reads key's value and return it.
writeMyEnv(key,value) : write key and value in myVar.env
removeMyEnv(key) : remove key and its value from myVar.env
  • myVar.env will be used for environment variable storing file.
    When any function runs, it checks if myVar.env exists and if not, creates one.
    All key and value will be written as key1=value1;key2=value2;key3=value3; …  in myVar.env
readMyEnv(property)
  - returns value of property (if not available, return false)

 

writeMyEnv(property,value)
 - write property and its value (if not available, return false)

 

removeMyEnv(property)
  - remove property and its value from env file (if not available, return false)

Leave a Reply