Hi,
1st you should not forget that Android is not designed to run various
scripts using just a single "executable" from an Android App. An app is
a package which is designed to contain all resources required for the
complete application. How to create this one can be found on Christians
http://www.androwish.org
Of course it is possble to start a single script by "Click to
AndroWish icon", the .wishrc of AndroWish can be used for that.
My solution is similar as shown on:
https://wiki.tcl-lang.org/page/AndroWish%3A+Tips+and+Tricks
where several solutions are described.
What I wanted is to "configure" one script which is started always. This
can be changed if another one should be executed in future.
I also have defined a fixed name for the script which becomes executed
if it exists, the name is "autostart.tcl" on a fixed localtion which is
the directory TCL on the SD-card (EXTERNAL_STORAGE) in my case.
My "setup-script" called setup_wrc.tcl creates the .wishrc file
accordingly:
---
# setup_wrc.tcl
# Create or update $HOME/.wishrc
#
set wishrc_src {
#
# WishRC startup script .wishrc
#
set source_dir [file join $env(EXTERNAL_STORAGE) TCL]
set auto_start [file join $source_dir autostart.tcl]
cd $source_dir
if {[file exist $auto_start]} {
source $auto_start
}
}
#############################################
# source directory and WishRC path
#
set source_dir [file join $env(EXTERNAL_STORAGE) TCL]
set wishrc_dst [file join $env(HOME) .wishrc]
puts -nonewline "Creating new WISHRC $wishrc_dst ... "
set fo [open $wishrc_dst {WRONLY CREAT TRUNC}]
puts $fo $wishrc_src
close $fo
puts "ok.\nContent of $wishrc_dst:"
set fi [open $wishrc_dst {RDONLY}]
puts [read $fi]
close $fi
puts "New WISHRC $wishrc_dst installed."
---
My favourite autostart.tcl is:
---
#
# Autostart script
#
set source_dir [file join $env(EXTERNAL_STORAGE) TCL]
sdltk textinput on
set script [tk_getOpenFile -initialdir $source_dir]
if {$script != ""} {
console hide
source $script
} else {
puts "Hello!\nNo AndroWish start script selected."
}
---
It opens the file browser to select a script from the TCL source
directory (/mnt/sdcard/TCL).
It is up to you to write a program which provides a list of scripts that
can be started on "button click" by autostart.tcl. This could be
dynamically created by scanning a directory which contains a list of all
available start scripts to execute, etc.
Bye,
Gerhard
--
Gerhard Reithofer - Techn. EDV Reithofer -
http://www.tech-edv.co.at