Need some help with JavaScriptlet for checking if music is playing - Tasker Tips & Tricks

I'm new for javascript , I want to write some script in tasker for check status
I found a post about it in google tasker group
but it's use Java Function
(sorry I can't post outside url now)
this is the code:
Code:
getMusicPlaying (122)
A1: Java Function [ Return:manage Class Or Object:CONTEXT Function:getSystemService
{Audio} (String) Param:audio Param: Param: Param: Param: Param: Param: ]
A2: Java Function [ Return:%playing Class Or Object:manage Function:isMusicActive {boolean} () Param: Param: Param: Param: Param: Param: Param: ]
A3: Flash [ Text:%playing Long:eek:ff ]
I want to do same thing in script , so I made code like this
Code:
manage = Context.getSystemService(Context.AUDIO_SERVICE);
if (manage.isMusicActive())
alert('playing');
else
alert('nothing')
But it can not work
could someone tell me how to do this with JavaScriptlet ?
by the way , how to check which app is playing , like just poweramp is playing now ,not google music ?
Thanks

I know I'm late, but do you/anyone else need this? I can help.

shadypr said:
I know I'm late, but do you/anyone else need this? I can help.
Click to expand...
Click to collapse
I am interested in how this works if your up for a quick lesson

Jackson.Armstrong.Blow said:
I am interested in how this works if your up for a quick lesson
Click to expand...
Click to collapse
OK I will explain the poweramp part, since it's the one that I needed:
nonewithnothing said:
by the way , how to check which app is playing , like just poweramp is playing now ,not google music ?
Thanks
Click to expand...
Click to collapse
..
So, what I wanted to achieve is to enable "Do Not Disturb" (DND) while music was playing, because with Hi-Res enabled, when I get notifications the audio switched to the phone's speakers, and when the notification sound finishes the music comes back to the headphones. The solution I created is basically using the poweramp API to detect if music was playing, the following is my profile and task:
API Link (from line 527 you can see the status class)
+ Event>System>Intent Received:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
+ new task, and the if/else if and such are under "Task"

Related

[C#/VB] System.Windows.Forms extensions for updating properties from other threads.

As developers, we all hate how our code looks like when using multi-threading, and usually, it's a real pain managing all the invoke methods. Even using anonymous methods, it never seemed to be the best way for me.
So, I decided creating a library, that manages everything for you. It checks if InvokeRequired, and if it is, it invokes itself automatically without writing a line of code.
I know, you'll say, we can write a method like this one for ourselves whenever we need it. Just carry on reading to see what's special in this one.
I've written it dynamically, taking in consideration the performance of the code. And it turned out pretty great, as fast as if you had written your own methods, but with cleaner coding.
The library adds an extension called SetProperty() to each control in System.Windows.Forms namespace.
Let's say we have a TextBox called txt, and we want to edit the property txt.Text in it to "Hello!", a normal invoke method would look like this:
Code:
private void UpdateText(){
if(txt.InvokeRequired){
txt.Invoke(delegate{UpdateText();});
}else{
txt.Text = "Hello!";
}
}
Referencing my library, you'll only need to write this:
Code:
txt.SetProperty(TextBoxProperties.Text, "Hello!");
Sounds pretty easy, doesn't it?
This works, for every single control out there. Even if you created a custom one, it will work for you.
A list of the properties of each control is shown as an enumeration with all the details you may need to know in its summary:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
A screenshot showing how the code looks like:
This will definitely avoid any issues you may have with cross thread exceptions, and even represent your code in a real neat way.
You can download it from here.
Please keep both DLL and XML files in the same directory after extracting.
Everything's set, you just have to Add reference to the library to your application, and enjoy!
Just use anyControl.SetProperty() method on the go.
I'll release a documentation later, but any feedback for the moment would be appreciated!
Thank you
Best regards,
ClaudeNegm
reserved
bump

Need a profile

Hey guys.
I was testing auto alarm plugin
I want my phone do a reboot 1 hour before alarm goes off.
As context i have autoalarm
As task i have plugin > secure settings > reboot if %hours matches 1,00
But it doesn't work
What's wrong?
calculation of alarm [-1]
Use it in some profile.. [Spoil]
Next Alarm -1 (278)
A1: AutoAlarm [ Configuration:No configuration needed Package:com.joaomgcd.autoalarm Name:AutoAlarm Timeout (Seconds):1 Continue Task After Errorn ]
A2: Variable Set [ Name:%nextalarmtime To:%hour Do Mathsff Appendff ]
A3: Variable Subtract [ Name:%nextalarmtime Value:1 Wrap Around:24 ]
A4: Variable Set [ Name:%Nextalarmtime To:%nextalarmtime:%minute Do Mathsff Appendff ]
[/Spoil]
Rebot phone before alarm [1h][Spoil]
Profile: Reboot 1H Before (279)
Time: From %Nextalarmtime Till %Nextalarmtime
Enter: Anon (280)
A1: Reboot [ Type:Normal ]
[/Spoil]
http://fii.cz/uhrubdf
frrancuz. said:
calculation of alarm [-1]
Use it in some profile.. [Spoil]
Next Alarm -1 (278)
A1: AutoAlarm [ Configuration:No configuration needed Package:com.joaomgcd.autoalarm Name:AutoAlarm Timeout (Seconds):1 Continue Task After Errorn ]
A2: Variable Set [ Name:%nextalarmtime To:%hour Do Mathsff Appendff ]
A3: Variable Subtract [ Name:%nextalarmtime Value:1 Wrap Around:24 ]
A4: Variable Set [ Name:%Nextalarmtime To:%nextalarmtime:%minute Do Mathsff Appendff ]
[/Spoil]
Rebot phone before alarm [1h][Spoil]
Profile: Reboot 1H Before (279)
Time: From %Nextalarmtime Till %Nextalarmtime
Enter: Anon (280)
A1: Reboot [ Type:Normal ]
[/Spoil]
http://fii.cz/uhrubdf
Click to expand...
Click to collapse
Hey friend
I've inported the task and profile
I tested it but it does nothing [emoji32]
Maybe i miss something?
Verstuurd vanaf mijn SM-G920F met Tapatalk
Go to vars overlap in Tasker.
%Nextalarmtime is set?
frrancuz. said:
Go to vars overlap in Tasker.
%Nextalarmtime is set?
Click to expand...
Click to collapse
Yes [emoji106]
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
No, it is empty.
No time set.
run task "next alarm -1", then check Variable.
frrancuz. said:
No, it is empty.
No time set.
run task "next alarm -1", then check Variable.
Click to expand...
Click to collapse
Thnx friend it's working now [emoji106] [emoji106]
Verstuurd vanaf mijn SM-G920F met Tapatalk

[Guide][Difficulty: Advanced] Create an IRS-Compliant Mileage Tracker

It's week two of my Tasker Pro series, so here's a new Tasker script for you guys to use. This script will show you how to create a mileage tracker/driving log that can save your butt during a tax audit if you claim mileage on your taxes!
http://www.xda-developers.com/tasker-pro-create-an-irs-compliant-mileage-tracker-and-get-money-back/
Please leave comments/feedback and any questions here.
Thanks for the amazing script! Only issue I'm having is that none of the data is being written to my google spreadsheet. When I use the test functionality in the tasker spreadsheet plugin, it writes the variable names in the rows. Any advice?
Sent from my Nexus 6P using Tapatalk
---------- Post added at 11:15 PM ---------- Previous post was at 11:05 PM ----------
I'm getting this error :
23.14.33/TD getStatic: Active load: true
23.14.33/Plugin PLUG setMetaData: start: type: Action code: 1446679033 pkg: com.joaomgcd.autotools clsOrLabel: com.joaomgcd.autotools.activity.ActivityConfigDate
23.14.33/Plugin PLUG setMetaData: end: type: Action code: 1446679033 pkg: com.joaomgcd.autotools cls: com.joaomgcd.autotools.activity.ActivityConfigDate label: AutoTools Time
23.14.33/Variables doreplresult: |%priority| -> |100|
Sent from my Nexus 6P using Tapatalk
The spreadsheet plugin does not populate the variables when you click test that's why nothing happens then
Now i am receiving this error on the exit task:
10.55.22/ActionArgBundle key: JoinOutputArray: replace <null> String value with null
10.55.22/Variables doreplresult: |{"cityresultfieldfilterjoaomgcdautotools":"","viewport_northeast_latresultfieldfilterjoaomgcdautotools":"","latlng":"%StartLoc","long_nameresultfieldfilterjoaomgcdautotools":"","formatted_addressresultfieldfilterjoaomgcdautotools":"","address_components_typesresultfieldfilterjoaomgcdautotools":""}| -> |{"cityresultfieldfilterjoaomgcdautotools":"","viewport_northeast_latresultfieldfilterjoaomgcdautotools":"","latlng":"%LOC","long_nameresultfieldfilterjoaomgcdautotools":"","formatted_addressresultfieldfilterjoaomgcdautotools":"","address_components_typesresultfieldfilterjoaomgcdautotools":""}|
10.55.22/ActionArgBundle AutoWeb Web Service: parameters: {"cityresultfieldfilterjoaomgcdautotools":"","viewport_northeast_latresultfieldfilterjoaomgcdautotools":"","latlng":"%StartLoc","long_nameresultfieldfilterjoaomgcdautotools":"","formatted_addressresultfieldfilterjoaomgcdautotools":"","address_components_typesresultfieldfilterjoaomgcdautotools":""} -> {"cityresultfieldfilterjoaomgcdautotools":"","viewport_northeast_latresultfieldfilterjoaomgcdautotools":"","latlng":"%LOC","long_nameresultfieldfilterjoaomgcdautotools":"","formatted_addressresultfieldfilterjoaomgcdautotools":"","address_components_typesresultfieldfilterjoaomgcdautotools":""}
10.55.22/E FIRE PLUGIN: AutoWeb Web Service / com.twofortyfouram.locale.intent.action.FIRE_SETTING: 14 bundle keys
10.55.22/E AutoWeb Web Service: plugin comp: com.joaomgcd.autoweb/com.joaomgcd.autoweb.broadcastreceiver.BroadcastReceiverFire
10.55.22/E add wait type Plugin1 time 120
10.55.22/E add wait type Plugin1 done
Any advice? Thank you!
Can you manually enter coordinates as variables and check to see if the plugin itself works? Maybe it's failing to get a location for you and that's why the plugin isn't working
Sorry for bringing this thread back, but now I'm encountering another issue. For some reason, Travel Time isn't displaying properly for me. Attaching screenshot for reference.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Sent from my Nexus 6P using Tapatalk

Is it possible to set a task to run between more than one time range?

I think that I know a way to accomplish what I am looking to do but it would require several profiles and several tasks. I'm new at this so I'm still working on wrapping my head around how tasker thinks and what it takes to get from point A to point B. I'm not looking for a step by step how to but more 1) to know if what I am trying to do is even possible 2) some pointers to get me pointed in the right direction if it is.
What I'm trying to accomplish, is a work profile that connects to wifi (that is the easy part) but then between the hours of say, 6 and 8, turn the volume down, turn the volume back up at break, turn the volume back down after break until 11am for lunch, turn it back up at lunch, and then back down for the remainder of the work day. What I am hoping, is that there is a way to create a task that allows me to turn the volume down if the time is between x and x or x and x or x and x.
Create two tasks. Task1 will put your phone on vibrate. Task2 will take phone off vibrate.
Create profiles for the time you want on vibrate calling for task1. On the profile you created, long-press the task and select an exit task. This will be task2.
Do this for all times you want using the same tasks.
Here is an example of how it should look...
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Thanks! That was exactly what I had done. I was just wondering if inside of the tasks themselves, you could set up time frames to do the specific tasks.. Its probably not an intelligent way to think or go about it.. I was just curious.
pulgoki said:
Thanks! That was exactly what I had done. I was just wondering if inside of the tasks themselves, you could set up time frames to do the specific tasks.. Its probably not an intelligent way to think or go about it.. I was just curious.
Click to expand...
Click to collapse
Well as long as it is all set to specific lengths of time, you could use task/wait and have the task actually running all day. But I don't know what that would do to battery life...
Can't you do it by time and have conditions? For example
IF %TIME > 07.59 And %TIME < 09.00
ELSE %TIME > 08.59 And %TIME < 10.00
ELSE %TIME > 09.59 And %TIME < 11.00
End if
Also just to mention the time stated in that variable seems to be 24hr format, regardless of system settings.

Help with Tasker automation to open Garage Door

Having recently gotten a Tesla Model3 I am keen to automate opening and closing the garage as I arrive and leave home.....
I have not found a way to (either voice or screen) initiate my garage opener app or Google Home routine from the Tesla.
My other option is to use my phone, but that involves fumbling for the phone, unlocking it, and either triggering the app or triggering a Google Home voice command to run a routing to trigger the app and open the garage door (which unfortunately also requires a PIN when doing through Google Home).
So I have decided to use an NFC tag trigger to Tasker to then automate opening the garage door app and opening the door. I have installed and gotten working the Trigger app, and have set up an NFC tag to trigger a task in Tasker. The NFC read seems to be working fine.
But my Tasker Task does not seem to be working. I have "played" it purely in Tasker (to isolate it from Trigger and NFC tag, and playing it doesn't result in the garage door opening.
I created the Task using AutoInput action - for which I opening the app (Remootio) and clicked on the lock/unlock toggle button. The task config is below, as well as the log from the action being run.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
11.10.40/ActionArgBundle key: NearbyText: replace <null> String value with null
11.10.40/ActionArgBundle key: RepeatTimes: replace <null> String value with null
11.10.40/ActionArgBundle key: TextToWrite: replace <null> String value with null
11.10.40/ActionArgBundle key: StoredAction: replace <null> String value with null
11.10.40/ActionArgBundle key: EnableDisableAccessibilityService: replace <null> String value with null
11.10.40/ActionArgBundle key: Password: replace <null> String value with null
11.10.40/ActionArgBundle key: RepeatInterval: replace <null> String value with null
11.10.40/E FIRE PLUGIN: AutoInput Action / com.twofortyfouram.locale.intent.action.FIRE_SETTING: 16 bundle keys
11.10.40/E AutoInput Action: plugin comp: com.joaomgcd.autoinput/com.joaomgcd.autoinput.broadcastreceiver.IntentServiceFire
11.10.40/E add wait type Plugin1 time 23
11.10.40/E add wait type Plugin1 done
11.10.40/E handlePluginFinish: taskExeID: 1 result 3
11.10.40/E pending result code
11.10.40/E add wait task
11.11.03/E Error: null
I'd love some help as to what I am doing wrong and why the outcome for the Task is not working....
Does the firmware of the application match the firmware of the device?
First of all, you should contact the developers of the application. They should advise you what to do in this situation because they know the software they have developed best. Secondly, you can try to contact Google for help. Perhaps they already have some developed techniques for managing gates without a phone. In my opinion, it is best to install automatic gates that open from the remote control. This eliminates the possibility of hacking. I ordered my gate from https://everlastgates.com/. This is a reliable company that does its job well. You can still see if it is possible to install a voice sensor.

Categories

Resources