-
Notifications
You must be signed in to change notification settings - Fork 75
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1ca4bc9
commit a4f70e5
Showing
15 changed files
with
209 additions
and
75 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,61 @@ | ||
|
||
module.exports = function(__runtime__, scope){ | ||
module.exports = function (__runtime__, scope) { | ||
var rtEngines = __runtime__.engines; | ||
var execArgv = null; | ||
|
||
var engines = {}; | ||
|
||
engines.execScript = function(name, script, config){ | ||
engines.execScript = function (name, script, config) { | ||
return rtEngines.execScript(name, script, fillConfig(config)); | ||
} | ||
|
||
engines.execScriptFile = function(path, config){ | ||
engines.execScriptFile = function (path, config) { | ||
return rtEngines.execScriptFile(path, fillConfig(config)); | ||
} | ||
|
||
engines.execAutoFile = function(path, config){ | ||
engines.execAutoFile = function (path, config) { | ||
return rtEngines.execAutoFile(path, fillConfig(config)); | ||
} | ||
|
||
engines.myEngine = function(){ | ||
engines.myEngine = function () { | ||
return rtEngines.myEngine(); | ||
} | ||
|
||
engines.all = function(){ | ||
engines.all = function () { | ||
return rtEngines.all(); | ||
} | ||
|
||
engines.stopAll = rtEngines.stopAll.bind(rtEngines); | ||
engines.stopAllAndToast = rtEngines.stopAllAndToast.bind(rtEngines); | ||
|
||
function fillConfig(c){ | ||
function fillConfig (c) { | ||
var config = new com.stardust.autojs.execution.ExecutionConfig(); | ||
c = c || {}; | ||
c.path = c.path || files.cwd(); | ||
if(c.path){ | ||
config.workingDirectory = c.path; | ||
if (c.path) { | ||
config.workingDirectory = c.path; | ||
} | ||
config.delay = c.delay || 0; | ||
config.interval = c.interval || 0; | ||
config.loopTimes = (c.loopTimes === undefined)? 1 : c.loopTimes; | ||
if(c.arguments){ | ||
config.loopTimes = (c.loopTimes === undefined) ? 1 : c.loopTimes; | ||
if (c.arguments) { | ||
var arguments = c.arguments; | ||
for(var key in arguments){ | ||
if(arguments.hasOwnProperty(key)){ | ||
for (var key in arguments) { | ||
if (arguments.hasOwnProperty(key)) { | ||
config.setArgument(key, arguments[key]); | ||
} | ||
} | ||
} | ||
return config; | ||
} | ||
|
||
var engine = engines.myEngine(); | ||
var execArgv = {}; | ||
var iterator = engine.getTag("execution.config").arguments.entrySet().iterator(); | ||
while(iterator.hasNext()){ | ||
var entry = iterator.next(); | ||
execArgv[entry.getKey()] = entry.getValue(); | ||
} | ||
engine.execArgv = execArgv; | ||
((engine) => { | ||
let execArgv = {} | ||
let iterator = engine.getTag("execution.config").arguments.entrySet().iterator(); | ||
while (iterator.hasNext()) { | ||
let entry = iterator.next(); | ||
execArgv[entry.getKey()] = entry.getValue(); | ||
} | ||
engine.execArgv = execArgv | ||
})(engines.myEngine()) | ||
|
||
return engines; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.