If anyone else wants a script to automatically import modified .js files elsewhere on your device into the script…

If anyone else wants a script to automatically import modified .js files elsewhere on your device into the script editor, here is one:

var scriptFolder = “/storage/emulated/0/LightningLauncher/script”;

LL.bindClass(“java.lang.StringBuilder”)

LL.bindClass(“java.io.FileReader”)

LL.bindClass(“java.io.BufferedReader”)

LL.bindClass(“java.io.File”)

LL.bindClass(“java.text.SimpleDateFormat”)

scriptNames = []

folder = new File(scriptFolder)

files = folder.listFiles()

for(i=0;i

name = files[i].getName()

length = name.length

if(name.substring(length-3,length)==”.js”){

scriptNames[scriptNames.length] = name

}

}

for(i=0;i

var script=LL.getScriptByName(scriptNames[i].substring(0,scriptNames[i].length-3));

file = new File(scriptFolder,scriptNames[i])

lmdate = file.lastModified()

tagdate = script.getTag(“lmdate”)

if(lmdate>tagdate||typeof tagdate == “undefined”){

text = new StringBuilder();

try {

br = new BufferedReader(new FileReader(file));

var line

while ((line = br.readLine()) != null) {

text.append(line);

text.append(‘\n’);

}

br.close();

script.setText(text);

date = new Date()

script.setTag(“lmdate”,date.getTime())

}

catch (err) {

throw(err)

}

}

}

http://java.io
]]>

One Commentto If anyone else wants a script to automatically import modified .js files elsewhere on your device into the script…

  1. Anonymous says:

    < ![CDATA[

    Cheers

    ]]>

Leave a Reply

Your email address will not be published. Required fields are marked *