How to run OS command from script? (e.g. open Facebook app on Android and iOS)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By lukas
:warning: Old Version Published before Godot 3 was released.

Is there a way to run a system command from script? I found OS.execute() but I didn’t figure out how to use it.
How I can use it to open Facebook app on Android and on iOS?

:bust_in_silhouette: Reply From: La_Blazer

You could theoretically use the OS.execute() command to run application on Android by am start -n com.example.project/.ExampleActivity but its not a good thing to do, because you would need to specify the package name and activity name which could be changed at any time and it would not work again… If you want to do it for “share” function, best thing you can do is write module with some android share library (like this one) and call it from GDscript that way…

Thanks for info. For now I solve this with OS.shell_open("http://...."), which open the site in browser. Not the best solution, but better than nothing.

lukas | 2016-03-04 16:58

No problemo :slight_smile: …better than nothing i guess :slight_smile:

La_Blazer | 2016-03-06 17:38