actually execute script
This commit is contained in:
parent
71c38516ac
commit
f20f412e50
1 changed files with 5 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
|||
import os
|
||||
import thread
|
||||
from mycroft import MycroftSkill, intent_handler
|
||||
|
||||
class RunScriptSkill(MycroftSkill):
|
||||
|
@ -26,9 +27,11 @@ class RunScriptSkill(MycroftSkill):
|
|||
|
||||
@intent_handler('RunScript.intent')
|
||||
def handle_run_script_intent(self, msg=None):
|
||||
script = msg.data.get('script', None)
|
||||
if script in self.scripts:
|
||||
script = msg.data.get('script', None).replace(" ", "-")
|
||||
script_path = os.path.join(self.script_dir, script)
|
||||
if script in self.scripts and os.path.isfile(script_path):
|
||||
self.speak_dialog('Running', {'script': script})
|
||||
thread.start_new_thread(os.system, (script_path))
|
||||
else:
|
||||
self.speak_dialog('NotFound', {'script': script})
|
||||
|
||||
|
|
Loading…
Reference in a new issue