Is there a way to run the SL4A script from a directory elsewhere?

sl4a has all its scripts in / sdcard / sl 4a / scripts

Is it possible to run a script that lives elsewhere:

eg. from / sdcard / dropbox / pyscripts [wink wink]

+4
source share
5 answers

I think that at this moment there is no answer.

The application is not able to set this path. The only other idea I had was to create a symbolic link from the Dropbox folder to the script directory. But this has some serious problems, the biggest of all, that most SD cards are formatted with FAT32, which simply does not support symbolic links. If you have another file system, you can try this way. Not sure if root is needed - I would suggest that writing to an SD card does not require this. Iโ€™m also not sure if the application correctly processes the link, but theoretically the whole link should be invisible to it and should be processed like a regular folder.

+1
source

It's a bit outdated, but I came here to find the answer to this question, and I found it, so I decided that I should share it with someone else, Google Googling, the same as me.

When you send the intent of Android to run a script in SL4A, you can specify any script in the file system. You can write a script to eliminate this intention (or an application if you like it). Here is an example in Python:

import android droid = android.Android() activity = 'com.googlecode.android_scripting.action.LAUNCH_BACKGROUND_SCRIPT' extras = {} extras['com.googlecode.android_scripting.extra.SCRIPT_PATH'] = '/any/script/you/like.py' packagename = 'com.googlecode.android_scripting' classname = 'com.googlecode.android_scripting.activity.ScriptingLayerServiceLauncher' intent = droid.makeIntent(activity, None, None, extras, None, packagename, classname).result droid.startActivityIntent(intent) 

I took this into account to make it easier (I hope) to see what happens. If you call getIntent () from a script, it will show you the anatomy of the intent that calls it. This is how I understood it.

+5
source

The answer to the old question .. But I found a way to do this using Dropsync (a free application) that can sync any folder on your SD card with a specific DropBox folder. It can synchronize in both directions, but also has many other synchronization options.

Dropsync: https://play.google.com/store/apps/details?id=com.ttxapps.dropsync&hl=en

+1
source

Try the Touchqode app. It can execute sl4a scripts.

0
source
 <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <data android:scheme="file" /> <data android:host="*" /> <data android:pathPattern=".*\\.py" android:mimeType="*/*" /> </intent-filter> 

Add this in App manifest to the mainactivity target filter

  String path = getIntent().getDataString(); if(path!=null){ //this happens if you open the app without clicking on any .py file path=path.substring(7); Intent intent=new Intent(); intent.setComponent(new ComponentName("com.googlecode.android_scripting","com.googlecode.android_scripting.activity.ScriptingLayerServiceLauncher")); intent.putExtra("com.googlecode.android_scripting.extra.SCRIPT_PATH",path); intent.setAction("com.googlecode.android_scripting.action.LAUNCH_FOREGROUND_SCRIPT"); startActivity(intent); System.exit(0); } 

Add this code to Main activity

Now you have a brilliant application that will run whenever you click on any file with the .py extension. To use more script types, add more pathPatterns. In addition, now you can write your own application to edit .py files / search for all scripts anywhere and all, and then run them in sl4a. There is an application in the game store called sl4a script launcher

0
source

Source: https://habr.com/ru/post/1381760/


All Articles