Tasker: ScreenRecord toggle task in Lollipop topic

SOCIALIZE IT ⇨

Hi,

I am trying to create a set of tasks in Tasker to start and stop the screenrecord process in Lollipop.
The individual tasks to start and stop the recording work fine, but I'm trying to create a single task that starts the recording if not currently recording and stop the recording if currently recording. This works fine in starting the recording, but the stop recording part doesn't execute.
I'm calling the individual tasks for starting and stopping the recording in this unified task.

I'm trying to get the pid of the screenrecord process and based on that start or stop the recording. Any suggestions are appreciated.


Code:


---------------------------------------------------------
TASK: ScreenieOpen
---------------------------------------------------------
Variable Set
        %isRunning = 0
Run Shell
        command pidof screenrecord
        Use Root
        Store Output In -> %%isRunning
        Store Errors In -> %%isRunning
        Continue Task After Error
If %isRunning ~ 1 OR %isRunning ~ 0
Then
        Perform Task
                ScreenieStart
                Stop
Else
        Perform Task
                ScreenieStop
End If

---------------------------------------------------------
TASK: ScreenieStart
---------------------------------------------------------
Variable Set ScrFile to S-%DATE-%TIMES.mp4
Secure Settings
        Configuration -> Show Touches Enabled
Flash
        Text - Recording Started
Run Shell
        command screenrecord /storage/sdcard0/DCIM/ScreenRecord/%ScrFile
        Use Root

---------------------------------------------------------
TASK: ScreenieStop
---------------------------------------------------------
Secure Settings
        Configuration -> Show Touches Disabled
Run Shell
        kill -2 $(pidof screenrecord)
Flash
        Text - Recording Stored @ /storage/sdcard0/DCIM/ScreenRecord/%ScrFile



xda-developers


0 commentaires:

Enregistrer un commentaire