Variable not updating.

80 views
Skip to first unread message

Vincent Palermo

unread,
Apr 30, 2016, 5:59:22 PM4/30/16
to Tasker
Hey guys. I made this task that I call night mode. Basically what it does is as follows: I have a tasker shortcut for the night mode task i.e. when i press the app on the homescreen it turns on night mode and when i press it again it turns it off. I attached screenshots of the task so you can get an idea of what it does. The problem that im running into is that when i press it once it works, but when i press it a second time it doesnt work until I launch any app. I press the app and nothing will happen until i launch an app like chrome or something. I included an alert to flash the value of the variable %nightmode, and interestingly enough the variable does not change until after i launch an app. Any ideas of what might be happening here? Is there something wrong with my code is this possibly a bug in tasker. Any help is appreciated. Thanks!
Screenshot_20160430-143544.jpg

Vincent Palermo

unread,
Apr 30, 2016, 6:34:58 PM4/30/16
to Tasker
Update: I forgot to include this piece of information. When i test the task from within tasker itself i.e. I press the play button inside the task it works perfectly every time.

Marta Hintz

unread,
May 4, 2016, 8:38:44 PM5/4/16
to Tasker
Dude, that pcx is incredible hard to see (old eys) - just post the description of the Profile/task.  export it and then paste here.  Don't export the xml - no one likes to try to read that either.  ;-}

Vincent Palermo

unread,
May 10, 2016, 1:22:59 AM5/10/16
to Tasker
Hey Marta, you should be able to zoom in on the screenshot to be able to read it. Otherwise, I would not have posted it. I was also able to figure out the problem. In the first part of the task it sets a black background. The second part of the task restores the original background. You cannot switch the wallpaper twice without having "refreshed" the homepage (turned off the screen and then turned it back on or going into an app and then going back to the homescreen). I corrected this by having the task launch and app and then close it right after after the wallpaper had been changed. Even though I already solved the problem I appreciate your response, Marta. Also, I will add the code if anyone is curious.

Night Mode (70)
A1: If [ %Nightmode ~ 0 ]
A2: Secure Settings [ Configuration:Airplane Mode Radios: Cell, Bluetooth, NFC, WiMax Timeout (Seconds):0 ] 
A3: Secure Settings [ Configuration:Airplane Mode Enabled Timeout (Seconds):0 ] 
A4: Set Wallpaper [ Image:Download/pure-black-wallpaper-159.jpg Scale:Off Crop:Off ] 
A5: Java Function [ Return:(AudioManager) audio_manager Class Or Object:CONTEXT Function:getSystemService
{Object} (String) Param:"audio" Param: Param: Param: Param: Param: Param: ] 
A6: Java Function [ Return: Class Or Object:audio_manager Function:setRingerMode
{} (int) Param:0 Param: Param: Param: Param: Param: Param: ] 
A7: Media Volume [ Level:0 Display:Off Sound:Off ] 
A8: Notification Volume [ Level:0 Display:Off Sound:Off ] 
A9: Haptic Feedback [ Set:Off ] 
A10: System Volume [ Level:0 Display:Off Sound:Off ] 
A11: Display Brightness [ Level:0 Disable Safeguard:On Ignore Current Level:Off Immediate Effect:Off ] 
A12: If [ %WIFI ~ off ]
A13: WiFi [ Set:On ] 
A14: End If 
A15: Variable Set [ Name:%Nightmode To:1 Do Maths:Off Append:Off ] 
A16: Launch App [ App:Tasker Data: Exclude From Recent Apps:Off Always Start New Copy:Off ] 
A17: Wait [ MS:500 Seconds:0 Minutes:0 Hours:0 Days:0 ] 
A18: Go Home [ Page:0 ] 
A19: WiFi Calling Controls [ Configuration:On Timeout (Seconds):0 ] 
A20: Flash [ Text:Night mode enabled Long:Off ] 
A21: Else If [ %Nightmode ~ 1 ]
A22: Secure Settings [ Configuration:Airplane Mode Disabled Timeout (Seconds):0 ] 
A23: Secure Settings [ Configuration:Airplane Mode Radios: Cell, Bluetooth, NFC, WiFi, WiMax Timeout (Seconds):0 ] 
A24: Haptic Feedback [ Set:On ] 
A25: Java Function [ Return:(AudioManager) audio_manager Class Or Object:CONTEXT Function:getSystemService
{Object} (String) Param:"audio" Param: Param: Param: Param: Param: Param: ] 
A26: Java Function [ Return: Class Or Object:audio_manager Function:setRingerMode
{} (int) Param:2 Param: Param: Param: Param: Param: Param: ] 
A27: Variable Set [ Name:%Nightmode To:0 Do Maths:Off Append:Off ] 
A28: System Volume [ Level:7 Display:Off Sound:Off ] 
A29: Media Volume [ Level:7 Display:Off Sound:Off ] 
A30: Set Wallpaper [ Image:Pictures/Wallpapers/-1921611128.jpg Scale:Off Crop:Off ] 
A31: Display Brightness [ Level:20 Disable Safeguard:Off Ignore Current Level:Off Immediate Effect:Off ] 
A32: WiFi Calling Controls [ Configuration:Off Timeout (Seconds):0 ] 
A33: Flash [ Text:Night mode disabled Long:Off ] 
A34: End If 

Marta Hintz

unread,
May 15, 2016, 12:57:32 PM5/15/16
to Tasker
Ah, it's all good. Thanks for the update. Must be my phone that didn't open it up bigger. Ttx
Reply all
Reply to author
Forward
0 new messages