This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm that you accept these cookies being set.

Script.create?
#15
You can use webrequest library in latest firmware to emulate web UI requests:
Code:
webrequest = require('webrequest')

-- user library name
libname = 'test'

-- create user library
params = {
  data = {
    id = 'user.' .. libname,
    name = libname,
    type = 'user',
    source = true, -- keep source
    load = false, -- autoload
    description = 'test description',
  }
}

res, err = webrequest('scripting', 'save', params)
log(res, err)

-- save user library source
params = {
  data = {
    id = 'user.' .. libname,
    scriptonly = true,
  },
  script = [[
    log('test user library')
  ]]
}

res, err = webrequest('scripting', 'save', params)
log(res, err)
Reply


Messages In This Thread
Script.create? - by FatMax - 12.01.2019, 06:52
RE: Script.create? - by Daniel - 14.01.2019, 08:48
RE: Script.create? - by Thomas - 14.01.2019, 11:51
RE: Script.create? - by FatMax - 16.01.2019, 06:28
RE: Script.create? - by Jayce - 17.01.2019, 08:16
RE: Script.create? - by admin - 17.01.2019, 12:59
RE: Script.create? - by epps - 18.04.2020, 18:11
RE: Script.create? - by JohnTH - 17.08.2022, 18:51
RE: Script.create? - by FatMax - 18.01.2019, 07:31
RE: Script.create? - by admin - 19.04.2020, 09:27
RE: Script.create? - by epps - 19.04.2020, 11:12
RE: Script.create? - by admin - 18.08.2022, 06:35
RE: Script.create? - by JohnTH - 18.08.2022, 19:44
RE: Script.create? - by FatMax - 13.09.2023, 21:02
RE: Script.create? - by admin - 14.09.2023, 07:17
RE: Script.create? - by FatMax - 15.09.2023, 12:46

Forum Jump: