CopySample

BeanShell

source("/sdcard/com.googlecode.bshforandroid/extras/bsh/android.bsh");
droid = Android();
text = "";
text = text + "source(\"/sdcard/com.googlecode.bshforandroid/extras/bsh/android.bsh\");\n";
text = text + "droid = Android();\n";
text = text + "droid.call(\"makeToast\",\"using BeanShell\");\n";
text = text + "droid.call(\"vibrate\");\n";
text = text + "droid.call(\"notify\",\"using BeanShell\",\"Message\");\n";
text = text + "//line comment\n";
text = text + "/*block\n";
text = text + "comment*/\n";
text = text + "print(\"using BeanShell\");\n";

droid.call("dialogGetInput","Sample","using BeanShell",text);
response = droid.call("dialogGetResponse");
result = response.get("result");
if (result.get("which").equals("positive")) {
  droid.call("setClipboard",result.get("value"));
  droid.call("makeToast",result.get("value"));
} else {
  droid.call("makeToast","Copy canceled");
}

Bex

include("/sdcard/com.googlecode.bexforandroid/extras/bex/android.bex")
droid = Android()
text = ""
text = text + "include(\"/sdcard/com.googlecode.bexforandroid/extras/bex/android.bex\")\n"
text = text + "droid = Android()\n"
text = text + "droid.call(\"makeToast\",\"using Bex\")\n"
text = text + "droid.call(\"vibrate\")\n"
text = text + "droid.call(\"notify\",\"using Bex\",\"Message\")\n"
text = text + "//line comment\n"
text = text + "/*block\n"
text = text + "comment*/\n"
text = text + "print(\"using Bex\")\n"

droid.call("dialogGetInput","Sample","using Bex",text)
response = droid.call("dialogGetResponse")
result = response.get("result")
if (result.get("which").equals("positive")) {
  droid.call("setClipboard",result.get("value"))
  droid.call("makeToast",result.get("value"))
} {
  droid.call("makeToast","Copy canceled")
}

Erlang

-module(copySample_Erlang).
-export([main/0]).
main()->
  Text = lists:concat([
    "-module(name).\n",
    "-export([main/0]).\n",
    "main()->\n",
    "  android:makeToast(\"using Erlang\"),\n",
    "  android:vibrate(),\n",
    "  android:notify(\"using Erlang\",\"Message\"),\n",
    "  %line comment\n",
    "  io:fwrite(\"using Erlang\").\n"
  ]),
  android:dialogGetInput("Sample","using Erlang",Text),
  Response = android:dialogGetResponse(),
  { struct,[{"value",Value},{"which",Result}]} = Response,
  if
    Result == "positive" ->
      android:setClipboard(Value),
      android:makeToast(Value);
    true ->
      android:makeToast("Copy canceled")
  end.

Html and JavaScript

<HTML><HEAD><SCRIPT>
var droid = new Android();
var text = "";
text = text + "<HTML><HEAD><SCRIPT>\n";
text = text + "var droid = new Android();\n";
text = text + "droid.makeToast(\"using HTML and JavaScript\");\n";
text = text + "droid.vibrate();\n";
text = text + "droid.notify(\"using HTML and JavaScript\",\"Message\");\n";
text = text + "//line comment\n";
text = text + "/*block\n";
text = text + "comment*/\n";
text = text + "document.write(\"using HTML and JavaScript\");\n";
text = text + "<\/SCRIPT><\/HEAD><BODY><\/BODY><\/HTML>\n"

droid.dialogGetInput("Sample","using HTML and JavaScript",text);
var result = droid.dialogGetResponse().result;
if (result.which == "positive") {
  droid.setClipboard(result.value);
  droid.makeToast(result.value);
} else {
  droid.makeToast("Copy canceled");
}
</SCRIPT></HEAD><BODY></BODY></HTML>

JRuby

droid = Android.new
text = ""
text = text + "droid = Android.new\n"
text = text + "droid.makeToast \"using JRuby\"\n"
text = text + "droid.vibrate\n"
text = text + "droid.notify \"using JRuby\",\"Message\"\n"
text = text + "#line comment\n"
text = text + "=begin block\n"
text = text + "=end comment\n"
text = text + "puts \"using JRuby\"\n"

droid.dialogGetInput "Sample","using JRuby",text
response = droid.dialogGetResponse()['result']
if response['which'] == "positive" then
  droid.setClipboard response['value']
  droid.makeToast response['value']
else
  droid.makeToast "Copy canceled"
end

JScheme

(import "com.googlecode.rpc.*")
(define droid (com.googlecode.rpc.Android.))
(define text "")
(set! text (string-append text "(import \"com.googlecode.rpc.*\")\n"))
(set! text (string-append text "(define droid (com.googlecode.rpc.Android.))\n"))
(set! text (string-append text "(.call droid \"makeToast\" \"Toast using JScheme\")\n"))
(set! text (string-append text "(.call droid \"vibrate\")\n"))
(set! text (string-append text "(.call droid \"notify\" \"Notify using JScheme\" \"Message\")\n"))
(set! text (string-append text ";line comment\n"))
(set! text (string-append text "(display \"using JScheme display\")\n"))
(set! text (string-append text "(newline)\n"))
(set! text (string-append text "(.println System.out$ \"using JScheme println\")\n"))
(set! text (string-append text "(exit)\n"))
(.call droid "dialogGetInput" "Sample" "using JScheme" text)
(define response (.call droid "dialogGetResponse"))
(define result (.get response "result"))
(if (.equals (.get result "which") "positive")
  (begin
    (.call droid "setClipboard" (.get result "value"))
    (.call droid "makeToast" (.get result "value"))
  )
  (.call droid "makeToast" "Copy canceled")
)
(exit)

Jawk

import com.googlecode.rpc.*;
BEGIN{
  droid = new Android();
  text = "";
  text = text "import com.googlecode.rpc.*;\n";
  text = text "BEGIN{\n";
  text = text "  droid = new Android();\n";
  text = text "  droid.call(\"makeToast\",\"using Jawk\");\n";
  text = text "  droid.call(\"vibrate\");\n";
  text = text "  droid.call(\"notify\",\"using Jawk\",\"Message\");\n";
  text = text "\#line comment\n";
  text = text "  printf(\"using Jawk printf\\n\")\n";
  text = text "  print(\"using Jawk print\")\n";
  text = text "}\n";

  droid.call("dialogGetInput","Sample","using Jawk",text);
  response = droid.call("dialogGetResponse");
  result = response.get("result");
  if (result.get("which").equals("positive")) {
    droid.call("setClipboard",result.get("value"));
    droid.call("makeToast",result.get("value"));
  } else {
    droid.call("makeToast","Copy canceled");
  }
}

Lua

require "android"
text = ""
text = text.."require \"android\"\n"
text = text.."android.makeToast(\"using Lua\")\n"
text = text.."android.vibrate()\n"
text = text.."android.notify(\"using Lua\",\"Message\")\n"
text = text.."--line comment\n"
text = text.."--[[block\n"
text = text.." comment]]\n"
text = text.."print(\"using Lua\")\n"

android.dialogGetInput("Sample","using Lua",text)
result = android.dialogGetResponse().result
if result.which == "positive" then
  android.setClipboard(result.value)
  android.makeToast(result.value)
else
  android.makeToast("Copy canceled")
end

PHP

<?php 
require_once("Android.php");
$droid = new Android();
$text = "";
$text = $text."<?php \n";
$text = $text."require_once(\"Android.php\");\n";
$text = $text."\$droid = new Android();\n";
$text = $text."\$droid->makeToast(\"using PHP\");\n";
$text = $text."\$droid->vibrate();\n";
$text = $text."\$droid->notify(\"using PHP\",\"Message\");\n";
$text = $text."#line comment\n";
$text = $text."//line comment 2\n";
$text = $text."/*block\n";
$text = $text."comment*/\n";
$text = $text."echo(\"using PHP echo\\n\");\n";
$text = $text."print(\"using PHP print\\n\");\n";
$text = $text."?>\n";

$droid->dialogGetInput("Sample","using PHP",$text);
$result = $droid->dialogGetResponse();
if ($result['result']->which == "positive") {
  $droid->setClipboard($result['result']->value);
  $droid->makeToast($result['result']->value);
} else {
  $droid->makeToast("Copy canceled");
}
?>

Perl

use Android;
my $droid = Android->new();
my $text = "use Android;\n";
$text = $text."my \$droid = Android->new();\n";
$text = $text."\$droid->makeToast(\"using Perl\");\n";
$text = $text."\$droid->vibrate();\n";
$text = $text."\$droid->notify(\"using Perl\",\"Message\");\n";
$text = $text."#line comment\n";
$text = $text."=comment block\n";
$text = $text."=cut comment\n";
$text = $text."print \"using Perl\\n\";\n";

$droid->dialogGetInput("Sample","using Perl",$text);
my $result = $droid->dialogGetResponse();
if ($result->{'result'}{'which'} eq "positive") {
  $droid->setClipboard($result->{'result'}{'value'});
  $droid->makeToast($result->{'result'}{'value'});
} else {
  $droid->makeToast("Copy canceled");
}

Python

import android
droid = android.Android()
text = ""
text = text + "import android\n"
text = text + "droid = android.Android()\n"
text = text + "droid.makeToast(\"using Python\")\n"
text = text + "droid.vibrate()\n"
text = text + "droid.notify(\"using Python\",\"Message\")\n"
text = text + "#line comment\n"
text = text + "\"\"\"\n"
text = text + "block comment\n"
text = text + "\"\"\"\n"
text = text + "print \"using Python\"\n"

droid.dialogGetInput("Sample","using Python",text)
result = droid.dialogGetResponse().result
if result.has_key('which') and result['which'] == 'positive':
  droid.setClipboard(result['value'])
  droid.makeToast(result['value'])
else:
  droid.makeToast("Copy canceled")

Rhino

load("/sdcard/com.googlecode.rhinoforandroid/extras/rhino/android.js");
var droid = new Android();
var text = "";
text = text + "load(\"/sdcard/com.googlecode.rhinoforandroid/extras/rhino/android.js\");\n";
text = text + "var droid = new Android();\n";
text = text + "droid.makeToast(\"using Rhino\");\n";
text = text + "droid.vibrate();\n";
text = text + "droid.notify(\"using Rhino\",\"Message\");\n";
text = text + "//line comment\n";
text = text + "/*block\n";
text = text + "comment*/\n";
text = text + "print(\"using Rhino\");\n";

droid.dialogGetInput("Sample","using Rhino",text);
var result = droid.dialogGetResponse();
if (result.which == "positive") {
  droid.setClipboard(result.value);
  droid.makeToast(result.value);
} else {
  droid.makeToast("Copy canceled");
}

Shell

Not solved. Please send me answers if you have.

Sleep

import com.googlecode.rpc.*;
$droid = [new Android];
$text = "import com.googlecode.rpc.*;\n";
$text .= "\$droid = [new Android];\n";
$text .= "[\$droid call : \"makeToast\",\"Toast using Sleep\"];\n";
$text .= "[\$droid call : \"vibrate\"];\n";
$text .= "[\$droid call : \"notify\",\"Notify using Sleep\",\"Message\"];\n";
$text .= "\#line comment\n";
$text .= "[[java.lang.System out] println : \"using Sleep java println\"];\n";
$text .= "println(\"using Sleep println\");\n";
$text .= "print(\"using Sleep print\\n\");\n";


[$droid call : "dialogGetInput","dialogGetInput","using Sleep",$text];
$response = [$droid call : "dialogGetResponse"];
$result = [$response get : "result"];
if ([[$result get :  "which"] equals : "positive"]) {
  [$droid call : "setClipboard",[$result get : "value"]];
  [$droid call : "makeToast",[$result get : "value"]];
} else {
  [$droid call : "makeToast","Copy canceled"];
}

Squirrel

android <- Android();

function conv4facade(text){
  local msg = "";
  for (local i = 0;i<text.len();i++) {
    if (text[i].tochar()=="\"") {
      msg+="\\\"";
    } else if (text[i].tochar()=="\n") {
      msg+="\\n";
    } else {
      msg+=text[i].tochar();
    }
  }
  return msg;
}

local text = "";
text += "android <- Android();\n";
text += "android.makeToast(\"using Squirrel\");\n";
text += "android.vibrate();\n";
text += "android.notify(\"using Squirrel\",\"Message\");\n";
text += "//line comment\n";
text += "/*block\n";
text += "comment*/\n";
text += "print(\"using Squirrel\");\n";

android.dialogGetInput("Sample","using Squirrel",conv4facade(text));
local response = android.dialogGetResponse();
if (response.result.which == "positive") {
  android.setClipboard(conv4facade(response.result.value));
  android.makeToast(conv4facade(response.result.value));
} else {
  android.makeToast("Copy canceled");
}

Tcl

Not solved. Please send me answers if you have.
return