Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: Async Shell Script Execution whenever Sketchware Starts #538

Closed
wants to merge 6 commits into from

Conversation

1tsMeMario
Copy link

Run a custom shell script whenever you start sketchware. Can be used for restoration or backup purposes or if you are advanced in shell scripting then whatever you can think of.

@1tsMeMario
Copy link
Author

Setting is in Mod Settings, by default it is turned off. Root and non-root users can use this script. Must manually create the script in root of Internal Storage. Name file sketchwarescript.sh

@JavkhlanK JavkhlanK added the feature A new feature label Aug 16, 2022
Copy link
Member

@JavkhlanK JavkhlanK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a few things that I think should be addressed, though I don't see this feature be useful for many people. Don't automatization apps already provide app launches as triggers? For example, Automate already has such a thing.

AsyncTask.execute(() -> {
if (ConfigActivity.isSettingEnabled(ConfigActivity.SETTING_EXECUTE_SHELL_SCRIPT)) {
try {
Runtime.getRuntime().exec("sh /sdcard/sketchwarescript.sh");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would a file at the root of Internal storage really be a good idea? I'd say put it into /Internal storage/.sketchware/ or /Internal storage/sketchware/ at least.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was actually where i had it in my last uodate but i had to do a revert so yes ill update that

try {
Runtime.getRuntime().exec("sh /sdcard/sketchwarescript.sh");
} catch (Exception e) {
System.out.println("Error " + e.getMessage());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe make it show a toast or at least an entry in debug.txt, no average user's gonna be looking in logcat for script errors.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i tried doing a toast but it never showed up after i made this asynchronous. maybe you know a solution?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds like a thread issue. UI things like toasts can only happen on the main/UI thread, and since AsyncTasks run in a new thread, try using runOnUiThread(Runnable) to display a toast.

Comment on lines -48 to +49
public static final String SETTING_BLOCKMANAGER_DIRECTORY_PALETTE_FILE_PATH = "palletteDir";
public static final String SETTING_BLOCKMANAGER_DIRECTORY_PALETTE_FILE_PATH = "paletteDir";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why? This will only break compatibility with older Sketchware Pro versions.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the pallete part ill change it back lol i just thought it was a spelling error sorry

@ilyassesalama
Copy link
Member

It's been almost a year now. @1tsMeMario will you make any changes to this pull request anytime soon?

@JavkhlanK
Copy link
Member

It's been almost a year now. @ 1tsMeMario will you make any changes to this pull request anytime soon?

though I don't see this feature be useful for many people. Don't automatization apps already provide app launches as triggers? For example, Automate already has such a thing.

@1tsMeMario
Copy link
Author

1tsMeMario commented Aug 11, 2023 via email

@ilyassesalama
Copy link
Member

@1tsMeMario As long as this pull request is active, we're still waiting for your changes. We love people who contribute to making Sketchware Pro even better. However, any contribution must be thoroughly reviewed before merging it to make sure it won't affect our users. You know, they have projects that must stay safe and we're responsible for that.

The last thing you said is "the pallete part ill change it back lol i just thought it was a spelling error sorry". So, we're waiting for your change to merge this pull request. You didn't even get back to us about this pull request. We would have clarified what is wrong/should be done.

Again, we're waiting for your changes, and why not some new awesome contributions in the future? Thanks for the time you've spent contributing to Sketchware Pro.

@hasrat-ali hasrat-ali closed this Mar 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature A new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants