prashantgbhangre / android-scripting

Automatically exported from code.google.com/p/android-scripting
0 stars 0 forks source link

Starting Sl4a scripts from App Inventor (ActivityStarter) #497

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I want to be able to make a gui in "app inventor", then run scripts with "Sl4a".

So i can make a app with gui for Android using Python, without having to know 
Java.

In "app inventor" you can start other programs, like APK's you have installed 
and so on. You then use "activitystarter" Palette.

Is there a way to start "Sl4a" using "activitystarter" in "app inventor"?

Exaples here: 
http://appinventor.googlelabs.com/learn/reference/other/activitystarter.html

Original issue reported on code.google.com by patc...@gmail.com on 31 Dec 2010 at 2:07

GoogleCodeExporter commented 9 years ago
You can launch from the adb shell using the following commands:
"am start -a  
com.googlecode.android_scripting.action.LAUNCH_FOREGROUND_SCRIPT -n  
com.googlecode.android_scripting/.activity.ScriptingLayerServiceLauncher -e  
com.googlecode.android_scripting.extra.SCRIPT_PATH  
/sdcard/sl4a/scripts/myscript.py"

or:

"am start -a  
com.googlecode.android_scripting.action.LAUNCH_BACKGROUND_SCRIPT -n  
com.googlecode.android_scripting/.activity.ScriptingLayerServiceLauncher -e  
com.googlecode.android_scripting.extra.SCRIPT_PATH  
/sdcard/sl4a/scripts/myscript.py"

So you should be able to translate that into an activity starter.
To clarify:
Action=com.googlecode.android_scripting.action.LAUNCH_FOREGROUND_SCRIPT
Service=com.googlecode.android_scripting/.activity.ScriptingLayerServiceLauncher
Extra=com.googlecode.android_scripting.extra.SCRIPT_PATH (with full path of 
script)

Original comment by rjmatthews62 on 31 Dec 2010 at 4:57

GoogleCodeExporter commented 9 years ago
I'd guess you could try the following:
Action: com.googlecode.android_scripting.action.LAUNCH_FOREGROUND_SCRIPT
ExtraKey: com.googlecode.android_scripting.extra.SCRIPT_PATH
ExtraValue: <fully qualified script path>
ActivityPackage: com.googlecode.android_scripting
ActivityClass: 
com.googlecode.android_scripting.activity.ScriptingLayerServiceLauncher

Original comment by rjmatthews62 on 31 Dec 2010 at 5:07

GoogleCodeExporter commented 9 years ago
ohh, nice. This works.

But i would also want to be able to start the script without the terminal 
window.

Is it also possible to return a value to App Inventor, so the value can be 
show'n in a label for example?

Original comment by patc...@gmail.com on 31 Dec 2010 at 1:21

GoogleCodeExporter commented 9 years ago
This should work with background scripts.
Can I get confirmation this works?

Action: com.googlecode.android_scripting.action.LAUNCH_BACKGROUND_SCRIPT
ExtraKey: com.googlecode.android_scripting.extra.SCRIPT_PATH
ExtraValue: <fully qualified script path>
ActivityPackage: com.googlecode.android_scripting
ActivityClass: 
com.googlecode.android_scripting.activity.ScriptingLayerServiceLauncher

Original comment by rjmatthews62 on 8 Jan 2011 at 12:42

GoogleCodeExporter commented 9 years ago
Details added to wiki page: AppInventor

Original comment by rjmatthews62 on 8 Jan 2011 at 12:51

GoogleCodeExporter commented 9 years ago
How is the return value received in App Inventor. Also what should be sl4a 
script return just print command or any other way ... Please suggest .

Original comment by chakrapa...@gmail.com on 13 May 2011 at 12:38