User Tools

Site Tools


script_fast_run

====== Differences ====== This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
script_fast_run [2014/03/31 18:49]
trianguloy created
script_fast_run [2015/12/11 16:52] (current)
trianguloy
Line 1: Line 1:
 ====== About the script ====== ====== About the script ======
-  * Purpose : This script will let you write/paste a script and run it directly from the eval javascript feature.+  * Purpose : This script will let you write/paste a script and run it directly from a custom ​eval javascript feature. ​ 
 +  * Version: [Moved to Play Store]
   * Author : [[https://​plus.google.com/​u/​1/​105066926163073195690|TrianguloY]]   * Author : [[https://​plus.google.com/​u/​1/​105066926163073195690|TrianguloY]]
-  * Link: https://​plus.google.com/​u/​1/​105066926163073195690/​posts/​geeR8FxuKd5+  * Link: https://​plus.google.com/​u/​1/​105066926163073195690/​posts/​dovekq6MuBE [[https://​plus.google.com/​u/​1/​105066926163073195690/​posts/​geeR8FxuKd5|First version]]
  
 +
 +====== APK ======
 +This script is now on Play Store! Go here to download it!
 +
 +https://​play.google.com/​store/​apps/​details?​id=com.trianguloy.llscript.fastRunTool
 +
 +
 +
 +
 +<spoiler | Old code>
 ====== How to use the script ====== ====== How to use the script ======
  
Line 10: Line 21:
 Features: Features:
   * - Automatically save the last executed script   * - Automatically save the last executed script
-  * - Custom predefined vars: e-event, c-container,​ i-item (of the event) +  * - Custom predefined vars: e-event, c-container,​ i-item (of the event) ​[if they are not available it will say so] 
-  * - custom function: Toast(string)+  * - Custom functions 
 +    * - void Toast(string) ​[will show a toast with the string] 
 +    * - NEW: string iTag(string) [use this to set fast and easily tags to the item and the container and/or to retrieve the tags. If you want to remove it call them with '​null'​ as string. Example iTag('​null'​) will remove the tag of the item and iTag() will just return the tag] 
 +    * - NEW: string cTag(string) [the same as iTag() but with the container'​s tag]  
 +  * - NEW: The value returned of the last line will automatically be shown except if there is a ';'​. Use this to quickly output values.
  
-IMPORTANT! +NEW IN VERSION 2: you can now use alert/prompt/whatever you want!
-Since it uses the eval function, ​you can'​t ​use alert,prompt ​or confirm. That's why I made the Toast one. (Timeouts work)+
  
  
 ====== Script code ====== ====== Script code ======
-<code+<sxh javascript> 
-/*Available vars*/+ 
 +/*Available vars */
 var e = LL.getEvent();​ var e = LL.getEvent();​
 var c = e.getContainer();​ var c = e.getContainer();​
 var i = e.getItem();​ var i = e.getItem();​
- 
  
 var text = LL.getScriptTag() || "";​ var text = LL.getScriptTag() || "";​
-var out = prompt("​Functions: ​ Toast(string);\nVars: e-event, c-container,​ i-item\n\nPrevious input: \n"​+text+"​\n_________________________________________________________",​text);​+ 
 +var out = prompt("​Functions: ​ Toast(string) ​"+ 
 +(c!=null ? ",​String cTag(String) ":""​)+ 
 +(i!=null ? ",​String iTag(String) ":""​)+ 
 +"\nVars: e-event,"+ 
 +(c!=null? "c-container,​":"​[no container],"​)+ 
 +(i!=null? "i-item":"​[no item]"​)+ 
 +"\n\nPrevious input: \n"+ 
 +text+ 
 +"\n_____________________________________",​text);​
 //Change this '​line'​ if you want //Change this '​line'​ if you want
 +
 if(out!=null) { if(out!=null) {
-    ​LL.setScriptTag(out);​ + LL.setScriptTag(out);​ 
-    eval(out);+  var last=out.lastIndexOf("​\n"​)+1;​ 
 + function returningTheSame(a){return a;}; 
 + if(out.substr(last).search(';'​)==-1) out=out.substr(0,​last)+"​prompt('​»"​+out.substr(last)+"​«',​returningTheSame( "​+out.substr(last)+"​));";​ 
 + 
 + out="​function fastRunTool(){"​+out+"​}";​ 
 + 
 + eval(out); 
 + fastRunTool();
 } }
  
  
-/*available functions*/​ + 
-function Toast(say){Android.makeNewToast(say,​false).show();​} +/*available functions */ 
-</code>+function Toast(say){ 
 + if(say==null)say="​null";​ 
 + Android.makeNewToast(say,​false).show();​ 
 +} 
 + 
 +function iTag(setnew){ 
 + if(setnew!=undefined){ 
 + if(setnew=='​null'​)setnew=null;​ i.setTag(setnew);​ 
 +
 + return i.getTag();​ 
 +
 + 
 +function cTag(setnew){ 
 + if(setnew!=undefined){ 
 + if(setnew=='​null'​)setnew=null;​ c.setTag(setnew);​ 
 +
 + return c.getTag();​ 
 +
 + 
 +</​sxh>​ 
 +</spoiler>
script_fast_run.1396291777.txt.gz · Last modified: 2014/03/31 18:49 by trianguloy