[answered] How to run script from QML ?
Hi
Guys, i need your help..
I want to run my script from qml file. I know it's possible. Coderus told me to check the sailfish-utilities as example and I did it. But I still can't get to work my button...
For example, I created page with slider and button, slider working and save parameter, and when I press on button it should start my script with command that included slider parameter. But it always show me message "failed" :(
I also tried to create identical copy of Lipstick restart button and changed only to my script and it also show me message "failed".
And yes I checked my script it work and permission is correct... I even added content of my script instead content of Lipstick restart script and in this case original button of lipstick restart working and run my script....
This is a reason that I don't understand why my button not working even it copy of original Lipstick restart button.
Maybe I need to run any specific command to activate it somehow before it will start working ? Really don't know...
Can someone, who understand, check my files and fix them if needed PLEEEEEEASE :)
https://dl.dropboxusercontent.com/u/17706605/Jolla1/speaker_test_button.zip
Folders "pages" and "entries" should be inside /usr/share/jolla-settings
Thanks
EDIT (25.12.15):
I found answer by myself :)
Look in to tools.js file in my zip and change this line:
exports.restartSpeaker = make_system_action("restart_speaker");
to this one:
exports.restartSpeaker = function(msg, ctx) {
var os = require("os");
os.system("/bin/sh", ["/usr/share/jolla-settings/pages/openrepos-testbutton/restart_speaker.sh"]);
};
and button starts working ! That's all :)
maybe these will help http://www.xargs.com/qml/process.html
http://askubuntu.com/questions/288494/run-system-commands-from-qml-app
ApB ( 2015-12-23 11:21:29 +0200 )editThanks, but it not really what I need (i think... already saw this links). Also I'm not programmer to understand all this stuff...
Schturman ( 2015-12-23 12:14:03 +0200 )editAs I said a good example in my case is a sailfish-utilities app. Just look and see how it start scripts, for example Lipstick restart... And after this see my files...