English help on website



getconfigのJSON/オブジェクト指定について(Ver9.34対応版)
目次関数(その他関数)getconfig− JSON/オブジェクト指定について

ファイルタイプ別の設定に関する設定: config  config "x"  config {...}  configcolor  configcolor {...}
ファイルタイプ別の設定に関する取得: キーワード  getconfig  getconfig {...}  getconfigcolor  getconfigcolor {...}


getconfig関数のパラメータ1を"{"から始まる文字列にした場合、取得する情報をJSONの文字列で指定し、JSONの文字列で取得します。(V9.22以降)
JavaScriptの場合は、オブジェクトを指定し、オブジェクトを取得します。

プロパティ名はconfigのJSON/オブジェクト指定と同じです。
プロパティと共に適当な値を指定します。取得されると値は上書きされます。
例:js{font=getconfig({Font:""});}

プロパティ名に"*"を指定すると、取得可能なものを全て取得します。ただし、ColorSetは明示的に指定して取得する必要があります。
例:js{all=getconfig({"*":""});}
例:js{cs=getconfig({ColorSet:{}});}
または、{}を指定しても全て取得します。(V9.25以降)
例:js{all=getconfig({});}
$json = getconfig("""
  {
    "Font": "",
    "FontPoint": 0,
    "FontDecimal": 0
  }
  """);
message $json;
js{
  obj = getconfig({
      Font: "",
      FontPoint: 0,
      FontDecimal: 0,
    });
  message( JSON.stringify(obj,null," "));
  message( obj.Font );
}
js{
  all=getconfig({});
  cs=getconfig({ColorSet:{}});
  all.ColorSet=cs.ColorSet;
  setVar("$out",JSON.stringify(all,null," "));
}
newfile;
insert $out;
endmacro;