User Tools

Site Tools


sample_code:droidscript_console

Differences

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

Link to this comparison view

sample_code:droidscript_console [2016/10/30 21:41]
105.59.166.110 DroidScript Console
sample_code:droidscript_console [2016/10/31 05:41]
Line 1: Line 1:
-**DroidScript Console** 
  
-Execute your droidscript commands directly from this app. 
-\\ 
-[[http://mycode.coolpage.biz/web/spk/DroidScriptConsole_v1.spk|Here]] is the spk. 
- 
-<code JavaScript DroidScriptConsole.js> 
- 
-//Code By Titus 
-//Called when application is started. 
-function OnStart() 
-{ 
-    app.SetOrientation("Portrait"); 
-    app.EnableBackKey(false ); 
-    //Create a layout with objects vertically centered. 
-    lay = app.CreateLayout("linear", "TopCenter,FillXY"); 
-    lay.SetBackColor("#000000"); 
-    //Create a text label and add it to layout. 
-    txt = app.CreateText("Droidscript Console", 1, 0.05, "Center"); 
-    txt.SetBackGradient("#999999", "#555555"); 
-    txt.SetTextColor("#000000"); 
-    txt.SetTextSize(23); 
-    lay.AddChild(txt); 
-    //Create Text Edit 
-    edt = app.CreateTextEdit("ds>: ", 1, .95, "NoSpell") 
-    edt.SetBackColor("#000000"); 
-    edt.Focus(); 
-    edt.SetTextSize(13); 
-    edt.SetOnEnter(clc); 
-    lay.AddChild(edt); 
-    //Add layout to app.  
-    app.AddLayout(lay); 
-} 
- 
-function clc() 
-{ 
-    var t = edt.GetText() 
-    var p = edt.GetCursorPos();; 
-    try 
-    { 
-        edt.SetText(t + "\n" + eval(edt.GetText().slice(t.lastIndexOf(":") + 1, t.length)) + "\n" + "ds>: "); 
-        edt.SetCursorPos(edt.GetText().length); 
- 
-    } 
-    catch (e) 
-    { 
-        edt.SetText(t + "\n" + e + "\n" + "ds>: "); 
-        edt.SetCursorPos(edt.GetText().length); 
- 
-    } 
-    var tt = edt.GetText() 
-    tt = tt.replace(/ds>:/g, function (v) 
-    { 
-        return v.fontcolor("green") 
-    }) 
-    tt = tt.replace(/ReferenceError[^\n]+/g, function (v) 
-    { 
-        return v.fontcolor("red") 
-    }) 
-    tt = tt.replace(/SyntaxError[^\n]+/g, function (v) 
-    { 
-        return v.fontcolor("#ff7733") 
-    }) 
-    tt = tt.replace(/TypeError[^\n]+/g, function (v) 
-    { 
-        return v.fontcolor("#779933") 
-    }) 
-    tt = tt.replace(/\n/g, "<br>") 
-    edt.SetHtml(tt); 
-} 
- 
-//Get properties and methods 
-function prop(objectname) 
-{ 
-    var s = "" 
-    var a = 0 
-    for (x in objectname) 
-    { 
-        a++; 
-        s += a + " " + x + "\n\n" + objectname[x] + "\n\n\n\n" 
-    } 
-    return s 
-} 
- 
-var cnt=0 
-function OnBack(){ 
-setTimeout(function(){cnt=0},1000) 
-if(cnt==1) app.Exit(); 
-else app.ShowPopup("Tap again to exit","Short" ); 
-cnt++ 
-} 
-</code> 
- 
-[[:|Home]]>>[[sample_code:|Sample Code]]\\ 
sample_code/droidscript_console.txt ยท Last modified: 2016/10/31 05:41 (external edit)