Expects a property 'script', containing the actual script to be run.
Specify 'page_interval_in_minutes' and 'page_offset_in_minutes'
to have script run periodically.
542656
public void setProperties(Properties properties) {
		script = properties.getProperty("script", script);
		pageIntervalInMinutes = Integer.parseInt(properties.getProperty("page_interval_in_minutes",
				"" + pageIntervalInMinutes));
		pageOffsetInMinutes = Integer.parseInt(properties.getProperty("page_offset_in_minutes",
				"" + pageOffsetInMinutes));
	}
942751
def run_script(dist_spec, script_name):
    """"""
    ns = sys._getframe(1).f_globals
    name = ns['__name__']
    ns.clear()
    ns['__name__'] = name
    require(dist_spec)[0].run_script(script_name, ns)
1245100
function run(transformFn, script) {
  const scriptEl = document.createElement('script');
  scriptEl.text = transformCode(transformFn, script);
  headEl.appendChild(scriptEl);
}
1142665
def run_script(self, requires, script_name):
        """"""
        ns = sys._getframe(1).f_globals
        name = ns['__name__']
        ns.clear()
        ns['__name__'] = name
        self.require(requires)[0].run_script(script_name, ns)
849956
def script(file, *args)
      begin
        cache = Minuteman::LUA_CACHE[Minuteman.config.redis.url]

        if cache.key?(file)
          sha = cache[file]
        else
          src = File.read(file)
          sha = Minuteman.config.redis.call("SCRIPT", "LOAD", src)

          cache[file] = sha
        end

        Minuteman.config.redis.call!("EVALSHA", sha, *args)

      rescue RuntimeError
        case $!.message
        when ErrorPatterns::NOSCRIPT
          Minuteman::LUA_CACHE[Minuteman.config.redis.url].clear
          retry
        when ErrorPatterns::DUPLICATE
          raise UniqueIndexViolation, $1
        else
          raise $!
        end
      end
    end
276615
def run_script(scriptfile):
    ''''''
    try:
        f = open(scriptfile, mode='r')
    except Exception:
        return
    mpstate.console.writeln("Running script %s" % scriptfile)
    sub = mp_substitute.MAVSubstitute()
    for line in f:
        line = line.strip()
        if line == "" or line.startswith('#'):
            continue
        try:
            line = sub.substitute(line, os.environ)
        except mp_substitute.MAVSubstituteError as ex:
            print("Bad variable: %s" % str(ex))
            if mpstate.settings.script_fatal:
                sys.exit(1)
            continue
        if line.startswith('@'):
            line = line[1:]
        else:
            mpstate.console.writeln("-> %s" % line)
        process_stdin(line)
    f.close()
21010
def validate_script_opts(identifier, opts)
      opts[:position] ||= -1
      opts[:priority] ||= :after

      raise JSS::InvalidDataError, "priority must be one of: :#{SCRIPT_PRIORITIES.keys.join ', :'}" unless \
        SCRIPT_PRIORITIES.include? opts[:priority]

      opts[:position] =
        case opts[:position]
        when :start then 0
        when :end then -1
        else JSS::Validate.integer(opts[:position])
        end

      # if the given position is past the end, set it to -1 (the end)
      opts[:position] = -1 if opts[:position] > @packages.size

      id = JSS::Script.valid_id identifier, api: @api
      raise JSS::NoSuchItemError, "No script matches '#{identifier}'" unless id
      id
    end
624124
def update_script(self, script_body):
        
        uri = "{}/script".format(self.data['uri'])

        return self._helper.update(script_body, uri=uri)
964370
function intervalStuff() {

    var message = "doing interval stuff at " + new Date()

    // add a timeout
    setTimeout(function() { console.log(message)}, 333)

    // add a timeline marker
    console.markTimeline(message)

    // write to local- and sessionStorage
    if (window.localStorage) {
        var smessage = message + " (local)"
        window.localStorage.setItem(  "item-" + storageIndex, smessage)
    }

    if (window.sessionStorage) {
        var smessage = message + " (session)"
        window.sessionStorage.setItem("item-" + storageIndex, smessage)
    }
    storageIndex++

    // write the message to the page
    output(message)

    // do an XHR
    var xhr = new XMLHttpRequest()
    // xhr.addEventListener("readystatechange", function() {logXhr(this)})
    xhr.open("GET", "../target/target-script.js", true)
    xhr.send()
}
1369782
function runScriptViaModuleLoader(script, context) {
    if(!fs.existsSync(script.fullPath)) {
        events.emit('warn', 'Script file does\'t exist and will be skipped: ' + script.fullPath);
        return Q();
    }
    var scriptFn = require(script.fullPath);
    context.scriptLocation = script.fullPath;
    context.opts.plugin = script.plugin;

    // We can't run script if it is a plain Node script - it will run its commands when we require it.
    // This is not a desired case as we want to pass context, but added for compatibility.
    if (scriptFn instanceof Function) {
        // If hook is async it can return promise instance and we will handle it.
        return Q(scriptFn(context));
    } else {
        return Q();
    }
}
1193641
def run_suite(self):
        '''
        
        '''
        if not self.phantomjs_runner:
            raise JsTestException('phantomjs_runner need to be defined')

        url = self.get_url()

        self.phantomjs(self.phantomjs_runner, url, title=self.title)
        self.cleanup()
483705
def run_script(config, output_dir, accounts, tags, region, echo, serial, script_args):
    """"""
    # TODO count up on success / error / error list by account
    accounts_config, custodian_config, executor = init(
        config, None, serial, True, accounts, tags, (), ())

    if echo:
        print("command to run: `%s`" % (" ".join(script_args)))
        return

    # Support fully quoted scripts, which are common to avoid parameter
    # overlap with c7n-org run-script.
    if len(script_args) == 1 and " " in script_args[0]:
        script_args = script_args[0].split()

    with executor(max_workers=WORKER_COUNT) as w:
        futures = {}
        for a in accounts_config.get('accounts', ()):
            for r in resolve_regions(region or a.get('regions', ())):
                futures[
                    w.submit(run_account_script, a, r, output_dir,
                             serial, script_args)] = (a, r)
        for f in as_completed(futures):
            a, r = futures[f]
            if f.exception():
                if serial:
                    raise
                log.warning(
                    "Error running script in %s @ %s exception: %s",
                    a['name'], r, f.exception())
            exit_code = f.result()
            if exit_code == 0:
                log.info(
                    "ran script on account:%s region:%s script: `%s`",
                    a['name'], r, " ".join(script_args))
            else:
                log.info(
                    "error running script on account:%s region:%s script: `%s`",
                    a['name'], r, " ".join(script_args))
207195
def execute_script(script, *args)
      args.map! do |e|
        e.is_a?(Element) ? e.wait_until(&:exists?).wd : e
      end
      returned = driver.execute_script(script, *args)

      browser.wrap_elements_in(self, returned)
    end
710130
def _run_script(self, session, file_path):
        
        if file_path:
            # The 'run' command returns False in case of error
            # The 'execute' method returns False if the run command fails
            return self._shell.execute('run "{0}"'.format(file_path), session)

        return None
274093
def run_script_api(module_name):
    ''''''
    filename = ''
    file_stream = ''
    #form = {k : try_json(v) for k,v in request.values.items()}
    form = request.values.to_dict(flat=False)
    if request.json:
        form.update(request.json)
    for x in form:
        if type(form[x]) == list and len(form[x]) == 1:
            form[x] = form[x][0]
    for x in form:
        form[x] = try_json(form[x])

    if len(request.files) > 0:
        # Get the name of the uploaded file
        f = request.files['file_upload']

        # Make the filename safe, remove unsupported chars
        filename = secure_filename(f.filename)
        file_stream = f.stream

    form['HTTP_AUTHORIZATION'] = get_authorization()
    form['filename'] = filename
    form['file_stream'] = file_stream
    try:
        result = registered_modules[module_name].WebAPI().run(form)
    except:
        raise
        #return jsonify({'error' : str(traceback.format_exc())})

    if result['output_type'] == 'file':
        return Response(result['output'],
                        mimetype='application/octet-stream',
                        headers={'Content-Disposition':
                                 'attachment;filename='+result['filename']})
    else:
        return jsonify(result)
557191
def script_input(module_name):
    ''''''
    if module_name not in registered_modules:
        return page_not_found(module_name)
    form = registered_modules[module_name].WebAPI()
    return render_template('script_index.html',
                           form=form,
                           scripts=registered_modules,
                           module_name=module_name)
985968
function runScript(script, context) {
    if (typeof script.useModuleLoader == 'undefined') {
        // if it is not explicitly defined whether we should use modeule loader or not
        // we assume we should use module loader for .js files
        script.useModuleLoader = path.extname(script.path).toLowerCase() == '.js';
    }

    var source;
    var relativePath;

    if (script.plugin) {
        source = 'plugin ' + script.plugin.id;
        relativePath = path.join('plugins', script.plugin.id, script.path);
    } else if (script.useModuleLoader) {
        source = 'config.xml';
        relativePath = path.normalize(script.path);
    } else {
        source = 'hooks directory';
        relativePath = path.join('hooks', context.hook, script.path);
    }

    events.emit('verbose', 'Executing script found in ' + source + ' for hook "' + context.hook + '": ' + relativePath);

    if(script.useModuleLoader) {
        return runScriptViaModuleLoader(script, context);
    } else {
        return runScriptViaChildProcessSpawn(script, context);
    }
}